I probably could have just asked, but there is far more satisfaction is spending an hour figuring it out for yourself.
Selecting a default value for a radio button is easy, but none of the examples I could find showed how to set the selection to the current (database) value so that one could later edit the record.
All the examples for coding radio buttons only show how to set the default value; which is fine if you want to add a new record.
I wanted to show the current value for an edit/update form of an existing record.
Sorry dude, I think you might have skipped ahead a couple of steps. you're going to have to spoon feed me a bit more until the lightbulbs come on!
- Radio buttons, cool. So you have a HTML form with some radio buttons...
- Your first bit of code does a check against a variable called authorized
- The value of this determines which radio button to be checked
I get all that.
Now you're talking about what to do if you've already got a value stored away in the database..?
The logic is basically the same: just imagine you grab the value from the DB and assign it to the variable authorized... Conditionally check the box that corresponds to the value.