Forum Moderators: coopster
Now, I want to pass it back to the first page so the radio button can be checked when someone wants to go back to change it.
The plan is to check if it's page 2 value is "hot" or "cold".
If hot, echo an input line in the form going back to the first page. If cold do the same but with a diff name.
Then on the first page check if "hotchecked" is true. If true then php puts "checked" in the input of the radio button form making it checked as before the preview. If "coldchecked" the same would happen making cold button checked.
This code below crashes when I try to get the value for comparison...
-------------------------------------
<?php if ($HTTP_POST_VARS["temp"]=="hot") {
echo "<input type="hidden" name="hotchecked" value="sss">"; }?>
<?php if ($HTTP_POST_VARS["temp"]=="cold") {
echo "<input type="hidden" name="coldchecked" value="sss">"; }?>
---------------------------------------
Thanks in advance,
Rock
See if this thread from last week will help: returning checked boxes from an array [webmasterworld.com]. It's about checkboxes, but radios work the same way.
...Thinking about it, your problem may be simpler than that. On your preview page, how about changing your code to:
<?php if ($_POST["temp"]=="hot") {
echo "<input type="hidden" name="hotchecked" value=" checked">"; }?> ...then at the top of your form page, initialize variables like:
$hotchecked = isset($_POST['hotchecked'])? " checked" : "";
...and in your form:
<input type="radio" name="temp" value="hot"<?php echo $hotchecked?>">