i cant get the code to email me that the user has checked the mailing list check box....
help please....
Artist/Designer
help please....
Code:
<?php
$your_email ='rscr@rossow-web.com';// <<=== update to your email address
session_start();
$errors = ';
$name = ';
$mailinglist = ';
$visitor_email = ';
$user_message = ';
if(isset($_POST['submitButton']))
{
$name = $_POST['name'];
$mailinglist = $_POST['mailinglist'];
$visitor_email = $_POST['email'];
$user_message = $_POST['message'];
///------------Do Validations-------------
if(empty($name)||empty($visitor_email))
{
$errors .= "\n Name and Email are required fields. ";
}
if(IsInjected($visitor_email))
{
$errors .= "\n Bad email value!";
}
if(empty($_SESSION['6_letters_code'] ) ||
strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0)
{
//Note: the captcha code is compared case insensitively.
//if you want case sensitive match, update the check above to
// strcmp()
$errors .= "\n Security code does not match!";
}
if(empty($errors))
{
//send the email
$to = $your_email;
$subject="A visitor to [URL unfurl="true"]www.anneleone.com[/URL] has sent you a message. See below.";
$from = $your_email;
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ';
$body = "A user $name submitted the contact form:\n".
"Name: $name\n".
"Mailing List: $mailing_list\n".
"Email: $visitor_email \n".
"Message: \n ".
"$user_message\n".
"IP: $ip\n";
$headers = "From: $from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
mail($to, $subject, $body,$headers);
header('Location: contact_sent.html');
}
}
// Function to validate against any email injection attempts
function IsInjected($str)
{
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str))
{
return true;
}
else
{
return false;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="T "/>
<title> | ARTWORK</title>
<link href="css/global_style.css" rel="stylesheet" type="text/css" />
<link href="css/contactform.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/font_stylesheet.css" type="text/css" charset="utf-8" />
<script language="JavaScript" src="scripts/gen_validatorv31.js" type="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="header">
<center><a href="index.html"><img src="images/title.jpg" width="502" height="82" alt="Anne Leone_title" border="0" /></a>
</center></div>
<div id="navbckgrnd">
<div id="nav_menucontainer">
<ul id="navmenu">
<li><a href="paintings.html" >Paintings</a></li>
<li><a href="bio.html" >Biography</a></li>
<li><a href="contact.html" >Contact</a></li>
</ul>
</div>
</div>
<div id="sitemap"><a href="index.html">home</a> | contact</div>
<br />
<div id="formwrap">
<form name="contact_form" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<fieldset>
<div class="row"><label for='name' class="col1">Full Name: </label>
<span class="col2">
<input name="name" class="input" type="text" id="name" size="20" tabindex="1" style="font-size:17px;" />
</span></div>
<div class="row"><label class="col1">Mailing List: </label>
<span class="col2"> <input name="mailing_list" type="checkbox" value="Please add me to the mailing list." /><font size="2">Please add me to the mailing list.</font> </span></div>
<div class="row"><label for='email' class="col1">Email: </label>
<span class="col2">
<input name="email" class="input" type="text" id="Email" size="20" tabindex="2" style="font-size:17px;"/>
</span></div>
<div class="row"><label for='message' class="col1">Comments: <br />Questions </label>
<span class="col2">
<textarea name="message" class="input" type="text" id="comments" cols="18" rows="5" tabindex="2" style="font-size:17px;"/></textarea>
</span></div>
<br /><br /><br /> <br /><br /><br /><br />
<div class="row"><label class="col1">Security Code: </label>
<span class="col2">
<img src="captcha_code_file.php?rand=<?php echo rand(); ?>" id='captchaimg' >
<br />
<br />
<input class="input2" id="6_letters_code" name="6_letters_code" type="text"><br />
<div id="errorloc" align="center">
<?php
if(!empty($errors)){
echo "<p class='err'>".nl2br($errors)."</p>";
}
?>
</div>
</span></div>
</fieldset> <div id="formbuttons"> <input type="submit" value="Submit" class="submitButton" name='submitButton'> </div>
</form>
</div>
<div id="footer"> </div>
</div>
<div class="copyright" >© 1999-2011test. All Rights Reserved.</div>
<script language="JavaScript">
// Code for validating the form
// Visit [URL unfurl="true"]http://www.javascript-coder.com/html...lidation.phtml[/URL]
// for details
var frmvalidator = new Validator("contact_form");
//remove the following two lines if you like error message box popups
//frmvalidator.EnableOnPageErrorDisplaySingleBox();
//frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("name","req","Please provide your name");
frmvalidator.addValidation("email","req","Please provide your email");
frmvalidator.addValidation("email","email","Please enter a valid email address");
</script>
<script language='JavaScript' type='text/javascript'>
function refreshCaptcha()
{
var img = document.images['captchaimg'];
img.src = img.src.substring(0,img.src.lastIndexOf("?"))+"?rand="+Math.random()*1000;
}
</script>
</body>
</html>
Artist/Designer