Hi. I have created a database called europe and a table called eu_place with the following fields and data
----------------------------------------------------------------------
id | country | city | full_price | half_price
1 | France | Paris | 50 | 50
2 | Spain | Barcelona | 70 | 85
Now what I am trying to do is to show a user a price based on the country selected from a drop down list, a city selected from a drop down list and then the user chooses full load price or half load price for that city and it displays the price.
I have managed to get the user to choose the country and city and I get the user to chooses the full load price or half load price but I think something is not right with my SQL.
This is the code that calculates the results, not sure if it is to do with the sql statement
here is all the codePHP Code:if ($load =='full_load'){
$result=mysql_query("SELECT full_price from eu_place where city = '$subcat' "); }
else {$result=mysql_query("SELECT half_price from eu_place where city = '$subcat' "); }
$cat is the country
$subcat is the city
$load is the radio button full load or half load
Hope someone can help cheers guys, its been tearing my hair out
PHP Code:<?php
include 'dd.php';
?>
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title>Demo Multiple drop down list box from plus2net</title>
</head>
<body>
<?php
$cat=$_POST['cat'];
$subcat=$_POST['subcat'];
$load=$_POST['load'];
echo "Value of \$cat = $cat <br>Value of \$subcat = $subcat"."<BR>";
echo "Value of \$load = $load";
if ($load =='full_load'){
$result=mysql_query("SELECT full_price from eu_place where city = '$subcat' "); }
else {$result=mysql_query("SELECT half_price from eu_place where city = '$subcat' "); }
echo mysql_error();
while ($row = mysql_fetch($result)) {
echo $row;
}
?>
</body>
</html>







Bookmarks