Are you using $_POST superglobal? You should use $_POST['CategoryName'] in findbycategory.php

Denis L. Menezes wrote:

Hello friends.

I have the following code :

The code works fine and the listbox is populated. But when I select a category and press the "Search" button, the variable $CategoryName is not passed to the page findbycategory.php. Can you please tell me where I am wrong?

Quote

<form name="form3" method="post" action="findbycategory.php">
<select name="CategoryName" id="select">
<?php //connecting to the database
$link = mysql_connect("localhost","mydomain","mypass");
if ($link){
Print "";
} else {
Print "No connection to the database";
}
if (!mysql_select_db("mydomain_com")){
Print "Couldn't connect database";
} else {
Print ""."<br>\n";
}

$sql="SELECT DISTINCT CategoryName From Categories ORDER BY CategoryName";
$result=mysql_query($sql);

While($Category=mysql_fetch_array($result))
{
Print(" <OPTION VALUE=\"$Category[0]\">$Category[0]\n");
}

?>
</select>
<input type="submit" name="Submit3" value="Search">
</form></td>

Unquote

Thanks
Denis


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to