<input type="radio" name="bid_status" value="1">one
<input type="radio" name="bid_status" value="2">two
<input type="radio" name="bid_status" value="3">three
<input type="radio" name="bid_status" value="4">four


I want the database to assign the correct button as "CHECKED", however I'm not sure how to do this.


FACTS:

the column which contains the value is an ENUM with the values 1 2 3 4.

I know how to READ the value from the database, but how do I create a loop that will read through all the different values within the single column to see which value it is?


The reason I would like to do this, instead of assigning none of the radio buttons as checked, is that if the user does not make a change to their status, i dont want their status to be modified to a "default" value.

Any help appreciated.

    Use the select tag instead, with 4 options. Create a loop that writes each option, and adds "SELECTED" to the option # that matches the current value. I'll leave coding this up to you 🙂

      It may be a good idea to use drop down menus. So you can run an if to see if they equal yes or no.

      It also may be a good idea to make the form post to this script. That way, you can see what it prints when the box is checked or unchecked:

      <? echo "$1" ;?><br>
      <? echo "$2" ;?><br>
      <? echo "$3" ;?><br>
      <? echo "$4" ;?>
      

      Have a fiddle with checked boxes and unchecked boxes to see what the values are when they are checked or not checked.

      As for the loop... I am not entirely certain!

      Hope this helps. Just reply if U need any help or add alex@tycooneden.com to your MSN messenger list.

        thanks Gents. I'll go with the SELECTED on the drop down

          Write a Reply...