Hi Forum,
---------------------------------------------------------------------------------------
Quick Question
-------------------------------------------------------------------------------------
How can I replace sa1 with the value of a $_Post in the following:
Code:
<td class='td1'>" . round ($row['field_sa1_value'] * $exchange_rate, -1) . " " . $currency_to . "</td>
I am new and honestly pretty rubbish, so I can't get it to work

---------------------------------------------------------------------------------------
Question Background
---------------------------------------------------------------------------------------
I am trying to make a comparison website using a simple form and some SQL, but as I am very much a PHP newbie, I have now run aground and I can not find info online that illuminate what I am doing wrong (I have been scratching my head for about 4 hours now).
Basically, I can't find a way get the value of the form into the generated data table.
FORM:
Code:
<form action="?" method="post">
<select name="duration">
<option value="1">1 Month</option>
<option value="2">2 Months</option>
<option value="3">3 Months</option>
<option value="4">4 Months</option>
<option value="5">5 Months</option>
<option value="6">6 Months</option>
<option value="7">7 Months</option>
<option value="8">8 Months</option>
<option value="9">9 Months</option>
<option value="10">10 Months</option>
<option value="11">11 Months</option>
<option value="12">1 Year</option>
</select>
<select name="accommodation">
<option value="sa">Shared Apartment</option>
<option value="pa">Private Apartment</option>
<option value="ha">Home Stay</option>
<option value="na">No Accommodation</option>
</select>
<input type="submit" />
</form>
TABLE:
Code:
<table class='table_schools' border='hidden' margin='0' padding='0'>
<tr class='tr1'>
<td class='td1'>School</td>
<td class='td2'>Established</td>
<td class='td3'>Class Size</td>
<td class='td1'>Monthly Cost </td>
<td class='td1'>Min age</td>
</tr>
<?php
mysql_connect($server,$user,$password);
@mysql_select_db($database) or die("Sorry, unable to select database");
$result = mysql_query("SELECT * FROM drup_content_type_school ORDER BY field_schoolname_value");
$i=0;
while($row = mysql_fetch_array($result))
{
if ($i % 2)
$class= "tr3";
else
$class= "tr2";
echo "<tr class='" . $class . "'>
<td class='td1'><a href='http://compare-chineselanguageschools.com/content/output-school?school=" . $row['field_schoolname_value'] . "'>" . $row['field_schoolname_value'] . "</a></td>
<td class='td2'>" . $row['field_est_value'] . "</td>
<td class='td3'>" . $row['field_max_class_size_value'] . "</td>
<td class='td1'>" . round ($row['field_sa1_value'] * $exchange_rate, -1) . " " . $currency_to . "</td>
<td class='td1'>" . $row['field_max_class_size_value'] . "</td>
</tr>
";
$i++;
}
?>
</table>
The bold "sa1" represents shared accommodation and 1 month in the form, how do I use $_Post inside the table thus getting it to say e.g. sa2?
So thankful,
Christopher