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

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

 

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

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