Option List Problem
Posted: Thu Feb 18, 2010 8:14 am
my database...

I want to display the cost based on selected city, currently it display all cost in the table...
anyone can help me...
Ill appreciate any advice
thanks
Code: Select all
---------------------------
id| name | reguler | extra
---------------------------
1 | City1 | 500 | 750
2 | City2 | 600 | 900
---------------------------

Code: Select all
<form name="calc" action="calc.php" method="post">
<?
include "conf.php";
echo "City <select name=name id=name>";
$city = "SELECT * from destination";
$reqcity = mysql_query($city) or die ("Error!");
while($result=mysql_fetch_array($reqcity))
{
echo "<option value=$result[name]>
$result[name]</option>";
}
echo "</select>";
echo "<p>Cost <select city=name id=name>";
$cost = "SELECT reguler,extra from destination";
$reqcost = mysql_query($city) or die ("Error!");
while($result=mysql_fetch_array($reqcost))
{
echo "<option value=$result[reguler]>$result[reguler]</option>";
echo "<option value=$result[ons]>$result[extra]</option>";
}
echo "</select>";
?>
<p>
<input type="submit" name="submit" value="submit">
</form>
</p>
anyone can help me...
Ill appreciate any advice
thanks