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.
$data = mysql_query("SELECT * FROM product")
or die(mysql_error());
$numrows = (mysql_num_rows ($data));
//loop for rows
if($numrows >0)
{
echo "<table width = 100% border = '1' cellspacing = '2' cellpadding = '0'>";
//loop for columns
$position = 1;
while ($phones = mysql_fetch_array($data)){
if($position == 1){
echo "<tr>";}
echo " <td>"."<img src='".$phones['pictureURL']."' title='".$phones['name']."'/><br /><input type='checkbox' title='".$phones['name']."'/></td> ";
if($position == 6)
{
echo "</tr> "; $position = 1;
}
else{
$position++;
}
}
$end = "";
if($position != 1){
for($z=(6-$position); $z>0 ; $z--){
$end .= "<td></td>";
}
$end .= "</tr>";
}
echo $end."</table> ";



Your
inputhas no name nor value:You need to give that a name and a value, then you will know what they selected:
Then, you can access
$_REQUEST['selection'](which will be an Array) to see which phones they selected: