PHP + Radio Buttons
Moderator: General Moderators
PHP + Radio Buttons
I have a table that is dynamically filled with data from a mysql database using a for loop. The first table cell in each row that is displayed has a radio button with a unique value, and a unique id based on the counter of the loop. When the use selects one of the radio buttons, is there a way that I can store that value into a session variable to be used on the next few pages (without having the table in a form)?
Re: PHP + Radio Buttons
You can tie the clicking of the radio button to an AJAX call that sends the data to the server to be stored in $_SESSION.
Unless you're doing other AJAX-y things on this page, I can't think of a reason why you'd need to record which radio was clicked, before submitting the form.
Unless you're doing other AJAX-y things on this page, I can't think of a reason why you'd need to record which radio was clicked, before submitting the form.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: PHP + Radio Buttons
The value doesnt need to be stored until the user clicks one of the buttons further down on the page which navigates them to a different page. Is it possible to take the value of the selected radio button without the radio button being in a form?
Re: PHP + Radio Buttons
It's possible, but you'd need Javascript to do it.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.