PHP string in checkbox
Posted: Sat Apr 12, 2014 4:59 am
I'm trying to display an array in HTML and next to each record is a checkbox, as below. I then want to be able to select a record by checking the checkbox and posting the 'value' of box2[ ] for that record. The problem I am having is the checkbox doesn't seem to post the value ($id), it only seems to handle static values (1,2,3 etc) instead of a string.
Any ideas how to work this, or suggesions for marking an individual record to then post it's id?
thanks
Any ideas how to work this, or suggesions for marking an individual record to then post it's id?
thanks
Code: Select all
$linkid=dbconnect("db");
mysql_select_db("db");
if(!($result = mysql_query("SELECT * FROM table WHERE id = '$id'"))) die ("Result error");
{
echo "<table>\n";
while ($myrow = mysql_fetch_array($result))
{
printf("<tr><td>%u</td><td><input type='checkbox' name='box2[ ]' value='$id'></td><td>%s</td><td>%s</td></tr>\n",
$myrow["id"],$myrow["descr"],$myrow["batno"],"]);
}
echo "</table>\n";
}//endwhile
}//endif