title: using hidden field to add data into database
body: <p>I'm adding data by using a hidden field. Initially it works and shows all the information I needed on my database. However, when I worked on it again, it only captures the same name as previous ones that was already captured before. </p>
  
  <p>For example there is an image of an apple and when I add, it should show the name as apple. Then when I click on the image of a pear, clearly it should shows 'pear' as the name in my database. But instead of 'pear', it shows as apple. Does anyone knows why?</p>
  
  <pre><code>&lt;form action="addOrder.php" method="post"&gt;
  &lt;td class="timgG"&gt;&lt;h4&gt;&lt;img src="apple.jpg" style="vertical-align: text-bottom;" title="Apple"/&gt; Apple &lt;br&gt;
  &lt;input type="hidden" name="op" value="add"&gt;
  &lt;input type="hidden" name="name" value="Apple"&gt; 
  &lt;input type="hidden" name="price" value="0.50"&gt;
  &lt;input type="submit" value="Add to Cart"&gt;
  &lt;/h4&gt;&lt;/td&gt;
  
  &lt;td class="timgG"&gt;&lt;h4&gt;&lt;img src="pear.jpg" style="vertical-align: text-bottom;" title="Pear"/&gt; Pear &lt;br&gt;
  &lt;input type="hidden" name="op" value="add"&gt;
  &lt;input type="hidden" name="name" value="Pear"&gt; 
  &lt;input type="hidden" name="price" value="0.50"&gt;
  &lt;input type="submit" value="Add to Cart"&gt;
  &lt;/h4&gt;&lt;/td&gt;
  &lt;/form&gt;
  
  
  &lt;?php
              if (isset($_SESSION['user_id'])) {
                  //$order_id = $_POST['order_id'];
                  $name = $_POST['name'];
                  //$quantity = $_POST['quantity'];
                  $price = $_POST['price'];
  
                  $query = "INSERT INTO order_details (name,price) VALUES ('" . $name . "','" . $price . "')";
                  $status = mysqli_query($link, $query) or die(mysqli_error($link));
  
                  if ($status) {
                      $msg = "Item has been added.&lt;br /&gt;";
                      $msg .= "&lt;a href='product.php'&gt;Back&lt;/a&gt;&lt;/p&gt;";
                  }
              } else {
                  $msg = "There was an error processing the form.Please try again &lt;a href=girls.php&gt;Back";
              }
              ?&gt;
  </code></pre>