Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001062

Re: [PHP-DB] how to preseve value of radio-butons when form is refreshed? From: Jonathan Hilgeman (jhilgeman <email protected>)
Date: 06/28/01

Lets say you have the following inputs:
<INPUT TYPE='Checkbox' NAME='MrCheckBox' VALUE='ImaChecked!'>
<INPUT TYPE='Radio' NAME='ColorPreference' VALUE='Green'>
<INPUT TYPE='Radio' NAME='ColorPreference' VALUE='Brown'>

And you wanted MrCheckBox to be marked, and the ColorPreference to be Brown.
You would have PHP output this:
<INPUT TYPE='Checkbox' NAME='MrCheckBox' VALUE='ImaChecked!' CHECKED>
<INPUT TYPE='Radio' NAME='ColorPreference' VALUE='Green'>
<INPUT TYPE='Radio' NAME='ColorPreference' VALUE='Brown' CHECKED>

I normally do this:
1. Retrieve Info from DB

2. If ( ColorPreference = Green )
    {
         $GreenChecked = "CHECKED";
     }
    elseif ( ColorPreference = Brown )
    {
         $BrownChecked = "CHECKED";
     }

<INPUT TYPE='Radio' NAME='ColorPreference' VALUE='Green' $GreenChecked>
<INPUT TYPE='Radio' NAME='ColorPreference' VALUE='Brown' $BrownChecked>

This way, one of those variables will contain the word CHECKED, which will
in turn, mark the desired radio button.

- jonathan

"Hector M Banda" <hector <email protected>> wrote in message
news:3B3B6967.5164235 <email protected>
> Hi all,
> How can I keep the values of objects like radio buttons on a PHP page
> when the page is refreshed?
>
> What I mean is that I 'm using the same form to interact with the user
> and to display the information based on the output of a particular
> query.
>
>
> Thanks,
>
> --
>
>
> -hb
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>