PDA

View Full Version : Radio buttons



1996 328ti
Mon 9th Jan '06, 8:59am
I had such good results from my last question I'd now like to ask,

I have specific profile fields in its own template using the profile.php script.
I am having a problem with radio buttons used for shirt sizes.
The radio button selection is saved but how do I show the radio button as checked the next time I visit the page.
Attached is what the page looks like.
<label for="rb_cpf_field26_1"><input type="radio" name="userfield[field26]" value="1" id="rb_cpf_field26_1" />S</label> &nbsp;
<label for="rb_cpf_field26_2"><input type="radio" name="userfield[field26]" value="2" id="rb_cpf_field26_2" />M</label> &nbsp;
<label for="rb_cpf_field26_3"><input type="radio" name="userfield[field26]" value="3" id="rb_cpf_field26_3" />L</label> &nbsp;
<label for="rb_cpf_field26_4"><input type="radio" name="userfield[field26]" value="4" id="rb_cpf_field26_4" />XL</label> &nbsp;
<label for="rb_cpf_field26_5"><input type="radio" name="userfield[field26]" value="5" id="rb_cpf_field26_5" />XXL</label> &nbsp;

FreshFroot_
Mon 9th Jan '06, 9:50pm
Just to clarify are you wanting the buttons that are squared that you can check instead of circle ones where you can only pick one choice?

1996 328ti
Mon 9th Jan '06, 9:57pm
Now I'm confused. :eek:

I have a field for t-shirt size that uses radio buttons.
{ } S { } M { } L { } XL { } XXL

I use this field value on another layout so I know when someone clicks on a size it is written to the database.
What I want is for when the user comes back to this page to see his/her choice.

{ } S { } M {•} L { } XL { } XXL for Large.


Edit: My guess is I need something like
<label for="rb_cpf_{$profilefieldname}_$key"><input type="radio" name="userfield[$profilefieldname]" value="$key" id="rb_cpf_{$profilefieldname}_$key" $checked />$val</label>
Thanks.

1996 328ti
Thu 12th Jan '06, 1:31am
I need to fix a similar problem with a menu selection box.
Somewhere I need to show what is checked for when the person comes back to the page.
When a user comes back to this page the top option is always display. I need to to display whatever option is stored.


<td class="alt1" valign="top"><select name="userfield[field24]" size="1">
<option value="National Capital">National Capital</option>
<option></option>
<option value="non-member">non-member</option>
<option value="Allegheny">Allegheny</option>
</select></td>