I have PHP code which creates a list with radio buttons for each list item.
$result = mysql_query("SELECT * FROM attitudes WHERE x_axis = '$famID'",$db);
$rowcheck = mysql_num_rows($result);
while ($row_user = mysql_fetch_assoc($result))
foreach ($row_user as $col=>$val) {
if ($col != $famID && $col != 'x_axis') {
list($famname) = mysql_fetch_row(mysql_query("SELECT familyname FROM families WHERE families_ID='$col'",$db));
echo "col $col famname $famname is val $val.";
echo "<input type = \"radio\" name = \"whichfam\" value = \"$col\" />";
echo "</br>";
}
}
Then I have a submit button at the bottom (and form tags for the whole thing)
I want to have two possible submissions. This code is intended to let the player raise or lower a value. They click on one of the radio buttons, and then select "Raise", or "Lower". It should then post to a backend and execute code to either raise or lower that value. I know how to do this in jquery, but I don't know how to have two SUBMIT buttons in PHP.
How can I do this?
(Specifically, how do I make two submission buttons work, the backend code should be relatively simple, $_POST or whatever)
Is this what you're looking for?
<button type="submit" name="submit1" value="submit1">submit1</button>
<button type="submit" name="submit2" value="submit2">submit2</button>
then
if(isset($_POST["submit1"])) {
} else if(isset($_POST["submit2"])) {
}