I have a form that will have the visitor either check or not check a box. If the box is checked I need the email to show that it is checked. How do I set this up? Here is the code.
<?php
$errors = '';
$myemail = 'corifoxworthy@foxdenwebsolutions.com';
if(empty($_POST['name']) ||
empty($_POST['email']))
{
$errors .= "\\r\
Error: all fields are required";
}
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$memory = $_POST['memory'];
$honor = $_POST['honor'];
if (!eregi(
"^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$",
$email))
{
$errors .= "\\r\
Error: Invalid email address";
}
if( empty($errors))
{
$to = $myemail;
$email_subject = "Wings of Hope for Pancreatic Cancer Research Dondation: $name";
$email_body = "You have received a new donation. ".
" Here are the details:\\r\
Name: $name\\r\
Address: $address\\r\
City: $city\\r\
State: $state\\r\
Zip Code: $zipcode\\r\
Email Address: $email\\r\
phone: $phone\\r\
memory: $memory\\r\
honor: $honor";
$headers = "MIME-Versin: 1.0\\r\
" .
"Content-type: text/plain; charset=ISO-8859-1; format=flowed\\r\
" .
"Content-Transfer-Encoding: 8bit\\r\
" .
"From: $myemail\\r\
" .
"Reply: $email_address\\r\
".
"Return-Path: $email_address\\r\
".
"X-Mailer: PHP" . phpversion();
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: thank_you.html');
exit();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Contact form handler</title>
</head>
<body>
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>
</body>
</html>
Here is the HTML
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>WINGS OF HOPE FOR PANCREATIC CANCER RESEARCH - DONATE</title>
<link href="css/wings.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="outer">
<header>
<h1>Wings of Hope for Pancreatic Cancer Research</h1>
</header>
<div class="nav_container">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="mission.html">Mission</a></li>
<li><a href="research.html">Ongoing<br>
Research</a></li>
<li><a href="directors.html">Board of<br>
Directors</a></li>
<li><a href="events.html">Events</a></li>
<li><a href="news.html">News</a></li>
<li><a href="comments.html">Patient/Caregiver<br>
Comments</a></li>
<li class="active"><a href="#">Donate</a></li>
</ul>
</div>
<div class="content_container">
<section class="row">
<div class="sec_one">
<p>Your donation directly helps fund the much needed research to end this deadly disease. You may designate your donation (below) in memory or honor of a loved one, friend, caregiver, etc.</p>
<p>After you have filled out the section below, please click the DONATION button and you will be taken to PayPal to donate any amount you choose. If you do not have a PayPal account, they are free, secure and easy to set up, or you may donate via check. </p>
<p>Our heartfelt thank you for helping in this cause.</p>
</div>
<div>
<p><img src="images/gulls.png" alt="gulls"></p>
</div>
</section>
<div class="hline"></div>
<section class="row">
<div class="sec_one">
<form action="contact-form-handler.php" method="post" id="contactform">
<br>
<p>
<label for='name'>Name:</label>
</p>
<p>
<input type="text" name="name" size="50" maxlength="100" />
</p>
<p>
<label for='address'>Address:</label>
</p>
<p>
<input type="text" name="address" size="50" maxlength="100" />
</p>
<p>
<label for='city'>City:</label>
</p>
<p>
<input type="text" name="city" size="25" maxlength="100" />
</p>
<p>
<label for='state'>State:</label>
</p>
<p>
<input type="text" name="state" size="25" maxlength="100" />
</p>
<p>
<label for='zipcode'>Zip Code:</label>
</p>
<p>
<input type="text" name="zipcode" size="15" maxlength="10" />
</p>
<p>
<label for='email'>Email:</label>
</p>
<p>
<input type="text" name="email" size="50" maxlength="100" />
</p>
<p>
<label for='phone'>Phone (optional):</label>
</p>
<p>
<input type="text" name="phone" size="25" maxlength="100" />
</p>
<p>
<label for='memory'>I would like to make my donation in memory of:</label>
</p>
<p>
<input type="text" name="memory" size="50" maxlength="100" />
</p>
<p>or</p>
<p>
<label for='honor'>I would like to make my donation in honor of:</label>
</p>
<p>
<input type="text" name="honor" size="50" maxlength="100" />
</p>
<p>
<label for='checkbox'>Please check box if you would like the family of the person your donation is honoring to receive written notification of your donation:</label>
</p>
<p>
<input type="checkbox" name="checkbox" />
</p>
<p>If you prefer to make your donation by check, please make check to: <br>
WINGS OF HOPE FOR PANCREATIC CANCER RESEARCH and send to: <br>
<p>Maureen A Shul</p>
<p>Wings of Hope for Pancreatic Cancer Research</p>
<p>8404 Brambleridge Drive</p>
<p>Castle Pines, Colorado 80108</p>
<p>
<input type="submit" value="Submit" />
<input type="reset" value="Reset" />
</p>
</form>
</div>
<div>
<p><img src="images/donate_page.png" alt="tulips"></p>
</div>
</section>
<div class="hline"></div>
<section class="row">
<div class="sec_one">
<p class="behope"><strong>JOIN THE EFFORT…BE A PART OF THE POSSIBLE, BE THE HOPE.</strong></p>
<div class="form">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="PEZ2ECYRKA42A">
<input type="image" src="http://wingsofhopepcr.org/images/donate_button.png" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
</div>
</section>
<!-- content_container -->
<div class="footer_container">
<div class="row">
<ul class="left">
<li><a href="index.html">Home</a></li>
<li><a href="mission.html">Mission</a></li>
<li><a href="research.html">Ongoing Research</a></li>
</ul>
<ul class="middle">
<li><a href="directors.html">Board of Directors</a></li>
<li><a href="events.html">Events</a></li>
<li><a href="news.html">News</a></li>
<li><a href="comments.html">Patient/Caregiver Comments</a></li>
</ul>
<ul class="right">
<li><a href="sponsors.html">Sponsors</a></li>
<li><a href="donate.html">Donate/Volunteer</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
<div class="row">
<div class="fb_link"><a href="https://www.facebook.com/WingsOfHopePCR?fref=ts" target="_blank"><img src="images/facebook_link.jpg" alt="facebook Logo Image"></a></div>
<div class="twitter_link"><a href="https://twitter.com/WingsofHopePCR" target="_blank"><img src="images/twitter_link.jpg" alt="Twitter Logo Image"></a></div>
</div>
<div class="copyright">Copyright © 2012 Wings of Hope for Pancreatic Cancer Research</div>
<div class="designBy"> Website Design By <a href="http://foxdenwebsolutions.com" target="_blank">Foxden Web Solutions</a> </div>
</div>
<!-- .footer_container -->
</div>
<!-- .outer -->
</body>
</html>