title: Using checkboxes to retrieve a foreign key, name, and value from mysql
body: <p>I'm working on a compare system just like verizon wirelesses compare system. I'm retrieving 30 phones from a database and I need to use check boxes to select which phones I want to compare with each other. I have a table that has the name of the phone and the image URL which works fine. My problem is how to retrieve the prodFK, Name, and value like shown below so that I can compare each phone with each other. I really hope that some one is patient enough to help me with this. This is my code to display the phones.  </p>
  
  <pre><code>    $data = mysql_query("SELECT * FROM product") 
  or die(mysql_error());
  $numrows = (mysql_num_rows ($data));
  
  
  //loop for rows
  if($numrows &gt;0)
  {
      echo "&lt;table width = 100% border = '1' cellspacing = '2' cellpadding = '0'&gt;";
  
  //loop for columns
      $position = 1;
      while ($phones = mysql_fetch_array($data)){
          if($position == 1){
              echo "&lt;tr&gt;";}
              echo " &lt;td&gt;"."&lt;img src='".$phones['pictureURL']."' title='".$phones['name']."'/&gt;&lt;br /&gt;&lt;input type='checkbox' title='".$phones['name']."'/&gt;&lt;/td&gt; ";
              if($position == 6)
              {
                  echo "&lt;/tr&gt; "; $position = 1;
              }
              else{
                  $position++;
              }
          }
  
  $end = "";
  if($position != 1){
  for($z=(6-$position); $z&gt;0 ; $z--){
  $end .= "&lt;td&gt;&lt;/td&gt;";
  }
  $end .= "&lt;/tr&gt;";
  }
  
  echo $end."&lt;/table&gt; ";
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/fyu8O.jpg" alt="enter image description here">
  <img src="https://i.stack.imgur.com/gkrhw.jpg" alt="enter image description here">
  <img src="https://i.stack.imgur.com/ODyKy.jpg" alt="enter image description here"></p>