By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,489 Members | 3,084 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,489 IT Pros & Developers. It's quick & easy.

Radio button/Checkbox value passing

P: n/a
I have a simple 3 page registration form. One form, one "data
validation" script and one "insert into database" script. The customer
bounces back and forth from the form to the verification script until
the data is all correct. (When I say bounces, I mean logically. All the
customer ever sees is the registration form, plus or minus error
messages.)

The problem I am having, is that if verification fails, the customer is
redirected to the form. I am able to pass the input values from the
"data validation" script back to the registration form using this
method:
<input id="Name" name="Name" type="text" value="<?php echo $Name ?>>

It works well, but I don't know how to pass the variable of a radio
button or check box back. I remember in javascript and other similar
languages you could do something like:
checkbox.value=checked

Is there a way to do this in PHP? What I am attempting to do, is make
is so that if the customer chooses YES on a radio button and the form
is submitted,; ifthey are sent back to the form to correct an error,
the radio button YES is still checked. I am not just trying to pass the
variable, but to also make it select the right option when it goes
back.

(Or is this just more of an HTML question, at which point I will ask
elsewhere)

Dec 8 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Jerim79 wrote:
...What I am attempting to do, is make
is so that if the customer chooses YES on a radio button and the form
is submitted,; ifthey are sent back to the form to correct an error,
the radio button YES is still checked...
AFAIR you have to use a condition to write "checked" into the tag if the
submitted value for the radio button group matches this button's value:
eg
<input type="radio" name="whatever" value="Yes"
<?php if ($whatever.value=="Yes") echo " checked";?>
>
(I hope I got that right; working from memory!)
Dec 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.