trying to create a form to send a email with the option to attach a image.
the form page is below and the action page below that - all i ever get is the error page " There was a problem sending your message, please try again later or call us 0207 421 5400."
i turned on the captcha echo to see if that was failing but this is working fine. any help and a fresh pair of eyes would be most helpful and appreciated.
<html>
<head>
<title>Loveit | Contact us</title>
<style type="text/css">
body {
font-family: Arial, "Trebuchet MS", Tahoma, sans-serif;
font-size: 11px;
line-height: 12px;
color: #444444;
}
a {
color: #FF0099;
font-weight: bold;
text-decoration: none;
}
strong{
color: #FF0099;
}
h1, h2, h3, h4, h5 {
color: #FF0099;
}
.popup {
padding: 10px;
}
table, tr, td {
font-family: Arial, "Trebuchet MS", Tahoma, sans-serif;
font-size: 11px;
line-height: 12px;
text-align: left;
}
input, textarea {
font-size: 11px;
line-height: 14px;
color: #444444;
background: #EEEEEE;
border: #BBBBBB 1px solid;
}
</style>
</head>
<body>
<div class="popup">
<h2>CONTACT US</h2>
<table width="100%">
<tr>
<td><!--<strong>Celebrity gossip:</strong> Rebecca Davison<br />
<strong>Email:</strong> <a class="readmore" href="mailto:rebecca.davison@burdamagazines.co.uk">CLICK HERE</a><br />
<strong>Tel:</strong> 0207 421 5429 -->
<strong>Beauty/Food:</strong> Elizabeth Doherty<br />
<strong>Email:</strong> <a class="readmore" href="mailto:elizabeth.doherty@burdamagazines.co.uk">CLICK HERE</a><br />
<strong>Tel:</strong> 0207 421 5438 </td>
<td><strong>Real Life: </strong>Lauren Cumming<br />
<strong>Email:</strong><a class="readmore" href="mailto:lauren.cumming@burdamagazines.co.uk"> CLICK HERE</a><br />
<strong>Tel:</strong> 0207 421 5421 </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td><p><strong>Senior Sales Executive:</strong> Clara Tobin<br />
<strong>Email:</strong> <a class="readmore" href="mailto:clara@peppublishing.co.uk">CLICK
HERE</a><br/>
<strong>Tel:</strong> 020 7421 5419<br>
</p>
<td><strong>Showbiz:</strong> Emma Pryer<br/>
<strong>Email:</strong> <a href="mailto:emma.pryer@loveitmagazine.co.uk">CLICK HERE</a><br/>
<strong>Tel:</strong> 020 7421 5447 </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td><!-- <br /><br/> -->
<strong>Classified Sales Executive:</strong> Ned Patten<br/>
<strong>Email:</strong> <a class="readmore" href="mailto:ned@peppublishing.co.uk">CLICK
HERE</a></td><br/>
<td><strong>Fashion:</strong> Charlotte Bell<br />
<strong>Email:</strong> <a class="readmore" href="mailto:charlotte.bell@burdamagazines.co.uk">CLICK HERE</a><br />
<strong>Tel:</strong> 020 7421 54427<br>
</tr>
<tr>
<td colspan="2" align="centre"><strong>Advertising Enquiries:</strong> 020 7421 5400 </td>
</tr>
</table>
<br />
Or please feel free to use the form below to contact us: <br />
<table width="100%" border="0">
<form enctype="multipart/form-data" method="post" action="comments_complete.php">
<tr>
<td width="15%">Full Name:</td>
</tr>
<tr>
<td width="85%"><input class="litext" type="text" name="name" size="35"></td>
</tr>
<tr>
<td>Telephone:</td>
</tr>
<tr>
<td><input class="litext" type="text" name="tel" size="20"></td>
</tr>
<tr>
<td><p>Email:</p>
</td>
</tr>
<tr>
<td><input class="litext" type="text" name="email" size="40"></td>
</tr>
<tr>
<td valign="top">Your message:</td>
</tr>
<tr>
<td><textarea onFocus="this.value=''" name="comments" rows="8" cols="35">Enter your comments here...</textarea></td>
</tr>
<tr>
<td valign="top">Attach a image:</td>
</tr>
<tr>
<td> <fieldset> <input type="file" name="picture" id="picture" /></fieldset></td>
</tr>
<tr>
<td><input class="litext" type="hidden" name="txt1" size="40" value=""></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<?php
$randomnum=rand(1000,9000);
?>
<form action='cont_sender.php?val=<?php echo $randomnum; ?>' method='post'>
<tr>
<td><img src='button1.php?number=<?php echo $randomnum; ?>'>
<input type='hidden' name='val' value='<?php echo $randomnum; ?>'></td>
</tr>
<tr>
<td><b>Please type the numbers above: </b></td>
</tr>
<tr>
<td><input type='text' name='captcha' /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="submit" /></td>
</tr>
</form>
</table>
</div>
</div>
</body>
</html>
<style type="text/css">
body {
font-family: Arial, "Trebuchet MS", Tahoma, sans-serif;
font-size: 11px;
line-height: 12px;
color: #444444;
}
a {
color: #FF0099;
font-weight: bold;
text-decoration: none;
}
strong {
color: #FF0099;
}
h1, h2, h3, h4, h5 {
color: #FF0099;
}
.popup {
padding: 10px;
}
table, tr, td {
font-family: Arial, "Trebuchet MS", Tahoma, sans-serif;
font-size: 11px;
line-height: 12px;
text-align: left;
}
input, textarea {
font-size: 11px;
line-height: 14px;
color: #444444;
background: #EEEEEE;
border: #BBBBBB 1px solid;
}
</style>
<?php
$val=mysql_real_escape_string($_REQUEST['val']);
$captcha=mysql_real_escape_string($_POST['captcha']);
$code=mysql_real_escape_string($_REQUEST['code']);
?>
<body style="padding:20px; background-color:#FFF; background-image:none;">
<h2 style="color: #FF0099;">CONTACT US</h2>
<?php
// get posted data into local variables
//$ip=$_SERVER['REMOTE_ADDR'];
$EmailFrom = Trim(stripslashes($_POST['email']));
$EmailTo = "james@peppublishing.co.uk";
$Subject = "Love It! Website Enquiry";
$Name = Trim(stripslashes($_POST['name']));
$Tel = Trim(stripslashes($_POST['tel']));
//$txt1= Trim(stripslashes($_POST['txt1']));
$Comments = Trim(stripslashes($_POST['comments']));
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (Trim($Name)=="") $validationOK=false;
if (Trim($comments)!="") $validationOK=false;
if ((string)$val!=(string)$captcha) $validationOK=false;
echo"<br/><br/>$val is the value and $captcha is the captcha";
if (!$validationOK) {
print "<br/><br/>You have not filled in the required fields";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\
";
$Body .= "Telephone: ";
$Body .= $Telephone;
$Body .= "\
";
$Body .= "Comments: ";
$Body .= $Comments;
$Body .= "\
";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$email>");
// redirect to success page
if ($success){
//<img style='margin-left:10px; margin-top:10px;' src='images/headers/comments_header.jpg' />
echo "<br/>
<p style='padding:10px;'>
Your message has been sent successfully!
</p>
";
}
else{
echo "
<br/>
<p style='padding:10px;'>
There was a problem sending your message, please try again later or call us 0207 421 5400.
</p>
";
}
?>
</body>
</html>