when php is called check what button is clicked on a dynamic
Posted: Fri Mar 28, 2008 12:51 pm
I have created a php that will query a database and give values and a submit button aka
[submit] John Doe
i create the submit button using
this works fine but when i go back in to click the button i dont know how to tell php what button i pushed. it would be easy to do an if statement but these could be buttons from 1 - 1000 and i dont want to write that many if statements
Can anyone help please
the code looks like this
[submit] John Doe
i create the submit button using
Code: Select all
echo "<input name='$col_value' type='submit' value='Select' /> ";
Can anyone help please
the code looks like this
Code: Select all
$query = mysql_query(
"SELECT `uniqid`,
`F_Name`,
`L_Name`
FROM `people`
ORDER BY `L_Name` ASC"
) or die (mysql_error());
$count = 0;
while ($line = mysql_fetch_array($query, MYSQL_ASSOC)) {
//echo "\t<tr>\n";
foreach ($line as $col_value) {
if ($count == 0){
echo "<input name='$col_value' type='submit' value='Select' /> ";
$count ++;
}else{
$nameval = ($col_value . " ");
echo "$nameval";
//echo "$col_value ";
}
}
$count = 0;
echo "<p>";
//echo "\t</tr>\n<br />";
}