title: How to remove mysql data from html delete button?
body: <p>I have a list of items and each one has a delete button, but nothing happens when I press it. The database is connected because it displays the items in the table, but I have no idea why the delete buttons aren't working. If anyone sees the error, please let me know. Thanks so much. Also, this is my first website so my code is messy for now. </p>
  
  <blockquote>
    <p>Note: I do close the database so that's not a problem.</p>
  </blockquote>
  
  <p><strong>user.php</strong>: </p>
  
  <pre><code>&lt;?php
  $user_id = '999';
  $host="127.0.0.1";
  $port=3306;
  $socket="";
  $user="root";
  $password="root";
  $dbname="peas";
   $db = new mysqli($host, $user, $password, $dbname, $port, $socket) or die ('Could not connect to the database server' . mysqli_connect_error());
  ?&gt;
  //continued 
  
  &lt;div style: "height:1000px; class="col-md-3" id="ingredients"&gt;
      &lt;ul class="list-group" style="max-height:900px; overflow-y:auto; overflow-x: hidden"&gt;
          &lt;?php
              $query = "SELECT  ingredient_name FROM Ingredient";
              $result = mysqli_query($db, $query);
  
              if(mysqli_num_rows($result) &gt; 0) {
                 while($row = mysqli_fetch_array($result)){   ?&gt;
                     &lt;li style="text-align: left; padding:10px" 
                      class="list-group-item"&gt;
                              &lt;form action="user_functions.php" method="post"&gt;
                                  &lt;?php echo $row['ingredient_name'];?&gt;
                                  &lt;input type="hidden" name="ingredient_name" value= "&lt;?php $row['$ingredient_name']; ?&gt;"&gt;
                                  &lt;button type="button" name="delete" style="float:right; border:none;"&gt;&amp;times;&lt;/button&gt;
                              &lt;/form&gt;
                      &lt;/li&gt;
              &lt;?php }
              mysqli_free_result($result);
              } else{
                  echo "&lt;li&gt;"."Pantry is Empty!"."&lt;/li&gt;";
              }
          ?&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>user_functions.php</strong>:</p>
  
  <pre><code>&lt;?php
      if(isset($_POST['delete'])){
          $ingredient_name=$_POST['ingredient_name'];
          $sql="DELETE FROM ingredient WHERE ingredient_name=$ingredient_name";
          $result = mysqli_query($db, $sql);
      }
  ?&gt;
  </code></pre>