Note that there are some explanatory texts on larger screens.

plurals
  1. POgetting a value from mysql db and post it to php page
    text
    copied!<p>i have a little problem while getting a value from database and post it to another page , heres my code . on search.php the user enter the price min and price max , then on page result.php it shows from database the name and price of the product and a link for more infos .(info.php) this 3rd page will show some additional informations based on the Id of the product shown on result.php i tried to hide the value of Id_product from result and post it to 3rd form but doesnt work.i got an error Notice: Undefined index: id in info.php line 4</p> <pre><code>//////search.php ///// &lt;form method="post" action="result.php" &gt; &lt;tr&gt; &lt;INPUT type=text size=20 name=pricemin &gt;&lt;BR&gt; &lt;/tr&gt; &lt;tr&gt; &lt;INPUT type=text size=20 name=pricemax &gt;&lt;BR&gt; &lt;/tr&gt; &lt;tr&gt; &lt;input type="submit" class="Nom" id="button" value="Valider" /&gt;&lt;/tr&gt;&lt;/form&gt; ///////result.php ////// &lt;?php include 'includes/connection.php'; $pricemin = $_POST['pricemin']; $pricemax = $_POST['pricemax']; $query = "SELECT * FROM product where price between '$pricemin' and '$pricemax'"; $result = mysql_query($query);?&gt; &lt;?php if(mysql_num_rows($result) &gt; 0) while($products = mysql_fetch_array($result)) {?&gt; &lt;?php echo $products['name_product'] ;echo $products['price_product'] ; echo "&lt;a href='http://localhost/mywebsite/info.php'&gt;More infos&lt;/a&gt;" ?&gt; &lt;form method="post" action="info.php" &gt; &lt;input type="hidden" name="id" value="&lt;?php echo $products['id_product']; ?&gt;" /&gt; &lt;/form&gt;&lt;?php } ?&gt;... ///// info.php ////// &lt;?php include 'includes/connection.php'; $id_product = $_POST['id']; $query = "SELECT * FROM product where id_product='$id_product'"; $result = mysql_query($query); ?&gt; &lt;html&gt;&lt;head&gt;&lt;title&gt;.. &lt;/title&gt;&lt;/head&gt;&lt;body&gt; &lt;?php while($products = mysql_fetch_array($result)) {?&gt; &lt;h1&gt;Product ID : &lt;?php echo $products['id_product'] ; ?&gt; &lt;/h1&gt; &lt;h1&gt;Product name : &lt;?php echo $products['name_product'] ; ?&gt; &lt;/h1&gt; &lt;h1&gt;Product Qt : &lt;?php echo $products['quantity_product'] ; ?&gt; &lt;/h1&gt; &lt;h1&gt;Product Spec : &lt;?php echo $products['spec_product'] ; ?&gt; &lt;/h1&gt; &lt;?php } ?&gt;&lt;/body&gt;&lt;/html&gt; </code></pre>
 

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