PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi community. The radio buttons on my form suddenly stopped working. For the life of me I can’t figure out why. Everything seems to look fine. I did some moving around on servers so I wonder if something got messed up during the transfer. I’m wondering if a new version of PHP was installed and made something obsolete. I was wondering if someone could take a look. Thank you in advance for your advise.
<form action="brian_1.php" method="post" name="form1" id="form1">
<input name="name" type="text" id="name" size="30" tabindex="1"/>
Company if Applicable:
<input name="company" type="text" id="company" size="30" tabindex="2"/>
Phone:
<input name="phone" type="text" id="phone" tabindex="3" onkeypress="return formatPhone(event,this)" onkeydown="return getKey(event,this)" size="13" maxlength="12"/>
Example: XXXXXXXXXX
Alternate Phone:
<input name="altphone" type="text" id="altphone" tabindex="4" onkeypress="return formatPhone(event,this)" onkeydown="return getKey(event,this)" size="13" maxlength="13"/>
Example: XXXXXXXXXX
Street Address:<input name="mail" type="text" id="mail" size="60" tabindex="5"/>
City, State, Zip Code:
<input name="city" type="text" id="city" size="60" tabindex="5"/>
E-mail:
<input name="emai" type="text" id="emai" size="60" tabindex="6"/>
Would you like to be part of our mailing list?
<label><input type="radio" name="list" value="Yes" id="RadioGroup1_0" tabindex="7"/>Yes</label><label><input type="radio" name="list" value="No" id="RadioGroup1_1" tabindex="8"/>No</label>
Are you interested in volunteering for upcoming events?
<label><input type="radio" name="volunteer" value="Yes" id="RadioGroup2_0" tabindex="9"/>Yes</label><label><input type="radio" name="volunteer" value="No" id="RadioGroup2_1" tabindex="10"/>No</label>
Are you interested in becoming a sponsor by receiving opportunities to advertise through us?
<label><input type="radio" name="opportunities" value="Yes" id="RadioGroup3_0" tabindex="11"/>Yes</label><label><input type="radio" name="opportunities" value="No" id="RadioGroup3_1" tabindex="12"/>No</label>
Would you like to join our efforts by offering your services or products to further our cause?
<label><input type="radio" name="cause" value="Yes" id="RadioGroup4_0" tabindex="15"/>Yes</label><label><input type="radio" name="cause" value="No" id="RadioGroup4_1" tabindex="16"/>No</label>
If so, in what ways would you like to contribute?
<textarea name="contribute" cols="60" rows="4"></textarea>
<input type="submit" name="Submit" value="Sumbit" /><input type="reset" name="reset" id="reset" value="Clear" />
</form>
<?php
/* Email Variables */
$emailSubject = 'Contact Form';
$webMaster = 'brianewagnerfund@gmail.com';
$webMaster = 'matt@webskillsplus.com';
//$webMaster = 'murrterr@rcn.com';
/* Data Variables */
$name = $_POST['name'];
$company = $_POST['company'];
$phone = $_POST['phone'];
$altphone = $_POST['altphone'];
$mail = $_POST['mail'];
$city = $_POST['city'];
$emai = $_POST['emai'];
if (isset($_POST["submit"])) {
echo $_POST["list"];
}
if (isset($_POST["submit"])) {
echo $_POST["volunteer"];
}
if (isset($_POST["submit"])) {
echo $_POST["opportunities"];
}
if (isset($_POST["submit"])) {
echo $_POST["cause"];
}
$contribute = $_POST['contribute'];
$body = <<<EOD
\r\n \r\n <br>
Name(s): $name \r\n <br>
Company if Applicable: $company \r\n <br>
Phone: $phone \r\n <br>
Alternate Phone: $altphone \r\n <br>
Street Address: $mail \r\n <br>
City, State, Zip Code: $city \r\n <br>
Email: $emai \r\n <br>
Would you like to be part of our mailing list? $list \r\n <br>
Are you interested in volunteering for upcoming events? $volunteer \r\n <br>
Are you interested in becoming a sponsor by receiving opportunities to advertise through us? $opportunities \r\n <br>
Would you like to join our efforts by offering your services or products to further our cause? $cause \r\n <br>
If so, in what ways would you like to contribute? $contribute \r\n <br>
EOD;
$from = "From: BrianEWagnerFund@gmail.com\r\n";
$from .= "Reply-To: ".$emai."\r\n";
$from .= "Content-type: text/html\r\n";
mail($webMaster, $emailSubject, $body, $from);
/* Results rendered as HTML */
echo "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.brianewagnerfund.org/thankyou.html\">";
?>
My apologies, yes I never receive values from them, that is, just the radio buttons. Everything else is working correctly. When you fill out the form and select yes or no for the radio buttons it sends everything via email except for any radio button answers. Any ideas?
Notice: Undefined index: name in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 31
Notice: Undefined index: company in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 33
Notice: Undefined index: phone in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 35
Notice: Undefined index: altphone in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 37
Notice: Undefined index: mail in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 39
Notice: Undefined index: city in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 41
Notice: Undefined index: emai in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 43
Notice: Undefined index: contribute in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 61
Notice: Undefined variable: list in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 85
Notice: Undefined variable: volunteer in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 87
Notice: Undefined variable: opportunities in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 89
Notice: Undefined variable: cause in /var/www/vhosts/www.brianewagnerfund.org/httpdocs/brian_1.php on line 91
<?php
/* Email Variables */
$emailSubject = 'Contact Form';
$webMaster = 'brianewagnerfund@gmail.com';
$webMaster = 'matt@webskillsplus.com';
//$webMaster = 'murrterr@rcn.com';
/* Data Variables */
$name = $_POST['name'];
$company = $_POST['company'];
$phone = $_POST['phone'];
$altphone = $_POST['altphone'];
$mail = $_POST['mail'];
$city = $_POST['city'];
$emai = $_POST['emai'];
if (isset($_POST["submit"])) {
echo $_POST["list"];
}
if (isset($_POST["submit"])) {
echo $_POST["volunteer"];
}
if (isset($_POST["submit"])) {
echo $_POST["opportunities"];
}
if (isset($_POST["submit"])) {
echo $_POST["cause"];
}
$contribute = $_POST['contribute'];
$body = <<<EOD
\r\n \r\n <br>
Name(s): $name \r\n <br>
Company if Applicable: $company \r\n <br>
Phone: $phone \r\n <br>
Alternate Phone: $altphone \r\n <br>
Street Address: $mail \r\n <br>
City, State, Zip Code: $city \r\n <br>
Email: $emai \r\n <br>
Would you like to be part of our mailing list? $list \r\n <br>
Are you interested in volunteering for upcoming events? $volunteer \r\n <br>
Are you interested in becoming a sponsor by receiving opportunities to advertise through us? $opportunities \r\n <br>
Would you like to join our efforts by offering your services or products to further our cause? $cause \r\n <br>
If so, in what ways would you like to contribute? $contribute \r\n <br>
EOD;
$from = "From: BrianEWagnerFund@gmail.com\r\n";
$from .= "Reply-To: ".$emai."\r\n";
$from .= "Content-type: text/html\r\n";
mail($webMaster, $emailSubject, $body, $from);
/* Results rendered as HTML */
echo "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.brianewagnerfund.org/thankyou.html\">";
?>
<?php
if (isset($_POST["submit"]))
{
/* Email Variables */
$emailSubject = 'Contact Form';
$webMaster = 'brianewagnerfund@gmail.com';
$webMaster = 'matt@webskillsplus.com';
//$webMaster = 'murrterr@rcn.com';
/* Data Variables */
$name = $_POST['name'];
$company = $_POST['company'];
$phone = $_POST['phone'];
$altphone = $_POST['altphone'];
$mail = $_POST['mail'];
$city = $_POST['city'];
$emai = $_POST['emai'];
$list = $_POST["list"];
$volunteer = $_POST["volunteer"];
$opportunities = $_POST["opportunities"];
$cause = $_POST["cause"];
$contribute = $_POST['contribute'];
$body = "
<br><br>
Name(s): $name<br>
Company if Applicable: $company<br>
Phone: $phone<br>
Alternate Phone: $altphone<br>
Street Address: $mail<br>
City, State, Zip Code: $city<br>
Email: $emai<br>
Would you like to be part of our mailing list? $list<br>
Are you interested in volunteering for upcoming events? $volunteer<br>
Are you interested in becoming a sponsor by receiving opportunities to advertise through us? $opportunities<br>
Would you like to join our efforts by offering your services or products to further our cause? $cause<br>
If so, in what ways would you like to contribute? $contribute<br>";
$from = "From: BrianEWagnerFund@gmail.com\r\n";
$from .= "Reply-To: ".$emai."\r\n";
$from .= "Content-type: text/html\r\n";
mail($webMaster, $emailSubject, $body, $from);
/* Results rendered as HTML */
header("Location: http://www.brianewagnerfund.org/thankyou.html");
}
?>
A sidenote, in many browsers you can submit a form by pressing Enter when in a field. Some browsers will not sent the submit button in this case. A check might be a hidden field or better to check $_SERVER['REQUEST_METHOD'] to see if it is POST.