How do I display radio button results?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a form which uses several radio buttons to enter data. It works fine  
as far as entering goes, but I can't figure out how to display which button  
is checked when I view the record. I could do a if-then routine but it  
seems like there should be an easier way.

Any help will be greatly appreciated.

Re: How do I display radio button results?

Bob Sanderson wrote:
Quoted text here. Click to load it

What's your HTML like and how are you dealing with it in PHP?

This (with possible unintended errors corrected) works:

    <!-- HTML, assume correct DOCTYPE, ... -->
    <form ...>
      <div class="group1">
        <label><input type="radio" name="r[0]" value="0" checked>none</label>
        <label><input type="radio" name="r[0]" value="1">one</label>
        <label><input type="radio" name="r[0]" value="1">two</label>
      <div class="group2">
        <label><input type="radio" name="r[1]" value="0" checked>none</label>
        <label><input type="radio" name="r[1]" value="1">one</label>
        <label><input type="radio" name="r[1]" value="1">two</label>
      <!-- some submit button -->

And the PHP that deals with it could be

    foreach ($_POST['r'] as $k=>$radio) {
      echo 'For group ', $k, ', you selected the option with ',
           $radio, " for its value.<br>\n";

I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.

Site Timeline