Ask your own question, for FREE!
Computer Science 10 Online
OpenStudy (bgrg007):

In php, how do I write 'if this particular radio button (ex. button1) was selected when clicking the submit button, echo "this"'? I have a table with 4 rows with each row containing 3 radio buttons.

OpenStudy (rsmith6559):

Each button has a name and a value. If I remember correctly, the name can be the same, and the value can change. That way the name is assigned the value of the selected radio button, and you can decide what to do from there. http://www.w3schools.com/html/html_forms.asp

OpenStudy (bgrg007):

if (isset($_POST['submit'])){ if($_POST[$radio_button_id] == 'update'){ echo "we are updating";}} I've tried this and the comment didn't print. I'm basically saying here that if I selected on the update radio button when I clicked the submit button, then page should echo "we are updating." I am doing this for several rows by the way. the variable name '$radio_button_id' gives each row a different name.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!