Forum Moderators: coopster
I am gathering rows of data from a mysql database. Each row has an id number. I need to select, using a checkbox, and number of these rows. I want the id number to be assosciated with the checkbox to be put into the address bar so I can use it on another page. I am using PHP.
Heres a plausible solution:
if($action=='compare') {
$comp_stage = $_GET['stage'];if(!isset($comp_stage)) {
echo '<form method="post" action="wi#*$!em.php?action=compare&stage=2">';
echo '<table>';
$comparesql = "SELECT id, descrip FROM finance_wish WHERE status = 'active' ORDER BY id DESC";
$compare = mysql_query($comparesql);
while ($row = mysql_fetch_assoc($compare)) {
$comp_descrip = $row['descrip'];
$comp_id = $row['id'];
?>
<tr>
<td><input type="checkbox" name="id" value="<? echo $comp_id;?>"></td>
<td><? echo $comp_descrip;?></td>
</tr>
</table>
<?
}
echo '<input type="submit" value="Compare">';
echo '</form>';
}
else {
$comp_ids = $_POST['id'];
}
echo $comp_ids;
}
?>
The only problem is, that it is only getting the id of the last selected option.
I guess my question is, How do you get the variable to hold a number of values?
Thank you everyone!
[edited by: jatar_k at 4:51 am (utc) on July 11, 2005]
[edit reason] no urls thanks [/edit]