Listbox variable
| From: | Denis L. Menezes | Date: | Mon, 03 Feb 2003 02:06:23 +0000 |
| Subject: | Listbox variable | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134072@lists.php.net to get a copy of this message | ||
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