Re: Listbox variable

From: Date: Mon, 03 Feb 2003 10:33:57 +0000
Subject: Re: Listbox variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-134093@lists.php.net to get a copy of this message
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


« previous php.general (#134093) next »