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:[EMAIL PROTECTED]]
Sent: 22 July 2001 03:13
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to