|  | Posted by Samuel van Laere on 04/14/07 22:32 
"Geoff Berrow" <blthecat@ckdog.co.uk> schreef in bericht news:qle223tb8f32u454acoa2j8nc9cegg9luc@4ax.com...
 > 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.
 
 Thank you Geoff, thats just what I need!
 Not bad for untested code though :)
 
 Cheers,
 Sam
  Navigation: [Reply to this message] |