RE: [PHP-DB] Now, I have new problem!!

From: Date: Sun, 22 Jul 2001 23:21:39 +0000
Subject: RE: [PHP-DB] Now, I have new problem!!
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10649@lists.php.net to get a copy of this message
Hi Tony Don't know if you got any feedback on this, but I would crate a form on the HTML page with an input type (say a dropdown list) with the name of, for example, itemnumber. The code could be something like this... <form method="post" action="inventory.php"> <select name="itemnumber"> <option value="9845">Item description</option> <option value="9846">Item description</option> <option value="9847">Item description</option> etc </select> </form> then in inventory.php you can retrieve the value of the variable $itemnumber to see which item was selected. Hope this helps! Dave -----Original Message----- From: Tony [mailto:tony777@qwest.net] Sent: 22 July 2001 03:13 To: php-db@lists.php.net Subject: [PHP-DB] Now, I have new problem!! My server has a cgi-local bin, where all of my cgi scripts have to be stored in there. When I input the script into my regular html pages, it doesn't work. This is the script that I am using and saved as inventory.php, <?php $link = mysql_connect("xxxx","xxxxx","xxxxx") or die ("Could not connect"); if (! @mysql_select_db("xxxxx") ) echo( "<P>Unable to locate the inventory " . "database at this time.</P>" ); exit();} $itemx = "9846"; $sql = "SELECT quantity FROM inventory WHERE item = '$itemx'"; $result = mysql_query($sql,$link); $row = mysql_fetch_array($result); $num = $row["quantity"]; if ($num < 1) { echo "<b><font color=\"#FF0000\">Out of Stock</font></b>"; } else { echo "<b><font color=\"#0000FF\">In Stock</font></b>"; } mysql_close($link); ?> How can I connect from my html page with known value of $itemx = "xxxx" to this scrip(inventory.php), and get result back on to my html page with words "In Stock" or "Out of Stock"? Can anybody help me please? Thanks for your time again. Tony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#10649) next »