Refreshing form with submittd data
| From: | Seb Frost | Date: | Thu, 06 Sep 2001 12:46:59 +0000 |
| Subject: | Refreshing form with submittd data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66210@lists.php.net to get a copy of this message | ||
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