djjjozsi;10948702 wrote:echo the $query and you will see the $_GET['prodcategory'] hasn't set.
If you have a form with POST method, you get the posted values by $_POST["prodcategory"].
You can easily design a double listbox Here
One little change should do here, is to change the queries and add userid fields into the tables.
Hi, thanks for your reply,
I have added userid to the tables and have fixed the code so that when I select a category and click a button I am taken to another page where there is a listbox with the products from that category, however I would like the category and product list boxes to be on the same page, I am more than happy to have the page refresh when the category is selected so that I don't have to use javascript.
CODE FOR PRODUCT LISTBOX:
<?php
require "session_logincheck.php";
require "connect.php";
?>
<?php
$query = "select * from product where prodcategory = '".$_GET['prodcategory']."' and userid = '".$_SESSION['userid']."'";
$result = @mysql_query($query, $connection)or die ("Unable to perform query<br>$query");
?>
<select name="dddd">
<?php
while($row=mysql_fetch_array($result))
{
echo '<option value="'.$row['prodid'].'">'.$row['prodname'].'</option>';
}
?>
</select>