Hi Everyone,
Im just beginning to learn PHP and Im tearing whats left of my hair out trying to handle variables between pages.. (Would love to know how to use cookies to do this one day), but anyway.. this bit of code always returns NULL for some reason, I cant work out how to pass the value from an option box to another php page?? Anyone??
<?
$hostname="localhost"; // Database Server Host
$dbusername="dbuser"; // MySQL user login
$databasename="mydbase"; // MySQL database name
$dbuserpass="thispassword"; // MySQL database password
$db = mysql_connect($hostname, $dbusername, $dbuserpass);
mysql_select_db($databasename, $db);
$result=mysql_query("SELECT * FROM pCategories ORDER BY Category");
echo "<FORM ACTION='showprod.php3?CatID=$CatVal' METHOD='POST'>";
echo "<select name=CatVal>";
while ($myrow=mysql_fetch_array($result))
{
$CatID = $myrow['CatID'];
$Category = $myrow['Category'];
echo "<option value=$CatID>$Category\n";
}
echo "</select>\n";
echo "<INPUT TYPE='SUBMIT' NAME='submit' VALUE='Print Value'>";
echo "</FORM>\n";
?>
Basically this code returns product category NAMES, however Im needing to pass the PRIMARY value returned to another page.
Any / All help very much appreciated...
Jason