Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting values depending on the dropdown
    text
    copied!<p>I have a dropdown list for items. What I want to do is get the item quantity, remaining quantity and dispatched item values which depends on the value in the drop down.</p> <p>I have this code :</p> <pre><code>&lt;form method="post" action="restore_stocks.php"&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;Item Name:&lt;/td&gt; &lt;td&gt;&lt;select name="itemname"&gt; &lt;?php $item="SELECT item_name FROM stocks"; $itemresult = @mysql_query($item)or die ("Error in query: $query. " . mysql_error()); while($row=@mysql_fetch_array($itemresult)){ echo "&lt;OPTION VALUE=".$row['item_name']."&gt;".$row['item_name']."&lt;/option&gt;"; } ?&gt; &lt;/select&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Item Quantity:&lt;/td&gt; &lt;td&gt;&lt;?php $row = mysql_fetch_object($itemresult); echo $row-&gt;item_quantity; ?&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Remaining Quantity:&lt;/td&gt; &lt;td&gt;&lt;?php echo $row-&gt;rem_quantity; ?&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Stocks Dispatched:&lt;/td&gt; &lt;td&gt;&lt;?php echo $row-&gt;stocks_dispatched; ?&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Add Stocks:&lt;/td&gt; &lt;td&gt;&lt;input name="addstocks" type="text" size="25" maxlength="25" /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;input type="submit" name="Submit" id="Submit" value="Restore" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>I really don't know how to start the code because i'm new to this approach. If you can help me it's much appreciated. Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload