Posted by Geoff Berrow on 04/14/07 20:42
Message-ID: <46213219$0$79139$e4fe514c@news.xs4all.nl> from Samuel van
Laere contained the following:
>I would like to check (checked="checked") the radiobutton the user
>pickt _after_ submitting the form, but just can't get it to work.
>
>So what is the secret?
A little function
function checkit($name_of_radiobutton,$val){
$checked=(isset($POST[$name_of_radiobutton])
&&$POST[$name_of_radiobutton]==$val)?"checked=\"checked\"" :"";
return $checked;
}
then in the code
<input type='radio' name='rb' value='foo' <?php echo
checkit('rb','foo);?>>
<input type='radio' name='rb' value='bar' <?php echo
checkit('rb','bar);?>>
Untested.
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
[Back to original message]
|