Re: how to preseve value of radio-butons when form is refreshed?

From: Date: Thu, 28 Jun 2001 22:26:32 +0000
Subject: Re: how to preseve value of radio-butons when form is refreshed?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-9959@lists.php.net to get a copy of this message
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@need-info.com> wrote in message news:3B3B6967.5164235@need-info.com... > 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@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#9959) next »