[PHP] Refreshing form with submittd data
I have 3 radio buttons, and I want the one selected by the user to show as selected when the page reloads. The form uses POST and points to itself. here's what I have: if ($thumbs==faster) { echo input type=\radio\ checked value=\faster\ name=\thumbs\Faster loading; echo input type=\radio\ value=\normal\ name=\thumbs\Normal thumbnails; echo input type=\radio\ value=\larger\ name=\thumbs\Higher quality; } elseif ($thumbs==larger) { echo input type=\radio\ value=\faster\ name=\thumbs\Faster loading; echo input type=\radio\ value=\normal\ name=\thumbs\Normal thumbnails; echo input type=\radio\ checked value=\larger\ name=\thumbs\Higher quality; } else { echo input type=\radio\ value=\faster\ name=\thumbs\Faster loading; echo input type=\radio\ checked value=\normal\ name=\thumbs\Normal thumbnails; echo input type=\radio\ value=\larger\ name=\thumbs\Higher quality; } How can I make this better? With a text field I can just do input type=\text\ name=\foo\ value=\$bar\ but I can't figure out how to do that sort of thing with radio buttons.. - seb --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Refreshing form with submittd data
On Thu, 6 Sep 2001 13:46:59 +0100, you wrote: I have 3 radio buttons, and I want the one selected by the user to show as selected when the page reloads. The form uses POST and points to itself. How can I make this better? With a text field I can just do input type=\text\ name=\foo\ value=\$bar\ but I can't figure out how to do that sort of thing with radio buttons.. ? function sel($what) { global $thumbs; return($thumbs==$what?'checked':''); } ? form method=post action=?=$PHP_SELF? pinput type=radio value=fas name=thumbs ?=sel('fas')? Faster/p pinput type=radio value=nor name=thumbs ?=sel('nor')? Normal/p pinput type=radio value=lar name=thumbs ?=sel('lar')? Larger/p pinput type=submit name=go value=Change/p /form djo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Refreshing form with submittd data
Thank you thank you thank you. Sheer genius :-) -Original Message- From: David Otton [mailto:[EMAIL PROTECTED]] Sent: 06 September 2001 22:18 To: Seb Frost Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Refreshing form with submittd data On Thu, 6 Sep 2001 13:46:59 +0100, you wrote: I have 3 radio buttons, and I want the one selected by the user to show as selected when the page reloads. The form uses POST and points to itself. How can I make this better? With a text field I can just do input type=\text\ name=\foo\ value=\$bar\ but I can't figure out how to do that sort of thing with radio buttons.. ? function sel($what) { global $thumbs; return($thumbs==$what?'checked':''); } ? form method=post action=?=$PHP_SELF? pinput type=radio value=fas name=thumbs ?=sel('fas')? Faster/p pinput type=radio value=nor name=thumbs ?=sel('nor')? Normal/p pinput type=radio value=lar name=thumbs ?=sel('lar')? Larger/p pinput type=submit name=go value=Change/p /form djo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]