You are here: Re: Checkstate of Radiobutton « All PHP « IT news, forums, messages
Re: Checkstate of Radiobutton

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация