title: HTML button not selecting correct form value
body: <p>HTML button not selecting correct form value.
  The following code selects data and displays it correctly in a html table: fname, lname , customer_id and the last column in the table shows a button labelled more info.
  The first part of the code works fine.</p>
  <pre><code>&lt;table&gt;
     &lt;thead&gt;
        &lt;tr&gt;
           &lt;th&gt;First Name&lt;/th&gt; &lt;th&gt;Last Name&lt;/th&gt; &lt;th&gt;Customer ID&lt;/th&gt;&lt;th&gt;Info&lt;/th&gt;
        &lt;/tr&gt;
     &lt;/thead&gt;
     &lt;tbody&gt;
       &lt;tr&gt;
           &lt;?php 
           $sql = &quot;select fname, lname,customer_id from customer_address &quot;;
           $result = mysqli_query($conn,$sql);
  
           while($row = mysqli_fetch_assoc($result)){
              $fname = $row['fname'];
              $lname = $row['lname'];
              $customer_id = $row['customer_id'];
              
           echo&quot; &lt;tr&gt;&quot;;
            echo&quot;&lt;td&gt;$fname&lt;/td&gt;&quot;;
            echo&quot;&lt;td&gt;$lname&lt;/td&gt;&quot;;
            echo&quot;&lt;td&gt;$customer_id&lt;/td&gt;&quot;;
            echo&quot;&lt;td&gt;&lt;input type='hidden' name='customer_id' value='$customer_id'&gt;&quot;;
            echo &quot;&lt;button type='submit' name='submit'&gt;More Info&lt;/button&gt;&lt;/td&gt;&quot; ; 
            }
            echo&quot; &lt;/tr&gt;&quot;;
                  ?&gt;
     &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  <p>With the second part of the code, I want to grab the customer_id when the button is clicked and display it below the table(I am going to uses the variable in a subsequent query to display more information later). The button selects the same customer_id no matter which button is clicked, and it is always the last record in the table. I would appreciate any help in correcting my error.</p>
  <pre><code>&lt;?php
  $ccf=&quot; &quot;;
  if(isset($_POST['submit'])){
  
    $ccf = $_POST['customer_id'];
  }
  echo &quot;Customer Id selected is:$ccf&quot;;
  ?&gt;
  </code></pre>