I have a loop that draws part of a form for me, it looks like this:
Code: Select all
<?
mysql_select_db($dbname);
$sql = "SELECT * FROM tablename ORDER BY id ASC";
$content = mysql_query($sql);
$Xcontent = mysql_fetch_array($content);
$cShowMax = mysql_num_rows($content);
for ($y=1; $y<=$cShowMax; $y++)
{
$id = $Xcontent["id"];
$present = $Xcontent["present"];
echo "<input name=\"present\" type=\"checkbox\" value=\"$present\">$present<br>";
$Xcontent = mysql_fetch_array($content);
}
mysql_free_result($content);
?>What I want is to say, name each checkbox individually, using the $id appended, for example:
Code: Select all
echo "e;<input name=\"e;present_$id\"e; type=\"e;checkbox\"e; value=\"e;$present\"e;>$present<br>"e;;So my question is: How can I pull the individual variables from my post data by their names, if I don't know what the names are? Is there some kind of function to parse the post data, extract names and use them to create variables for use in my php project?
Currently I've been doing it manually like below, but I know it won't work, as I said, I don't know what they will be called, nor how many will be selected:
Code: Select all
$get_present = $_GET['present'];Any advice really appreciated,
Rob