Copy link to clipboard
Copied
Hi David,
I'm trying to set the initial state of a radio group to none.
Please look at the file http://ecopethandbags.com/contact.php. The initial state is set to "No"
In Dreamweaver, I've set the initial state to "Unchecked"
I don't understand the code for the radio buttons in my file (see attachment).
What I am trying to do is to have the radio group initially unchecked but required.
I have 2 questions:
1) - How can I control the initial status of the radio group when I use the PHP form validation?
2) - How can I set the validation so, when one of the radio buttons is not checked by the user, a warning flag like "Please make a choice" comes up.
Thank you much!
Just change the following section of code:
<?php
if (!$_POST || isset($missing) && $_POST['subscribe'] == 'n') {
echo 'checked="checked"';
} ?>
Remove the !$_POST || like this:
<?php
if (isset($missing) && $_POST['subscribe'] == 'n') {
echo 'checked="checked"';
} ?>
The checked="checked" will be inserted into the code only if the form has been submitted, but neither radio button has been selected.
Copy link to clipboard
Copied
Just change the following section of code:
<?php
if (!$_POST || isset($missing) && $_POST['subscribe'] == 'n') {
echo 'checked="checked"';
} ?>
Remove the !$_POST || like this:
<?php
if (isset($missing) && $_POST['subscribe'] == 'n') {
echo 'checked="checked"';
} ?>
The checked="checked" will be inserted into the code only if the form has been submitted, but neither radio button has been selected.
Copy link to clipboard
Copied
It works!
Thank you much David!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more