<?php
if (array_key_exists('send', $_POST)) {
$to = '[email protected]';
$subject = 'contact form super saver';
$name = $_POST['name'];
$email = $_POST['email'];
$Tel = $_POST['Tel'];
$message = $_POST['message'];
$message = "Name: $name\n\n";
$message .= "email: $email\n\n";
$message .= "Tel: $Tel\n\n";
$message .= "message: $message";
$message = wordwrap($message, 70);
$mailSent = mail($to, $subject, $message);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css" media="screen">
body {
background-color:#FFF;
color:#252525;
font-family:Arial, Helvetica, sans-serif;
font-size:100%;
}
h1{
font-family:Verdana, Geneva, sans-serif;
font-size:150%;
}
p{
font-size:85%;
margin:0 0 5px 25px;
max-width: 650px;
}
form {
width:600px;
margin:15px auto 10px 20px;
}
label {
display:block;
font-weight:bold;
}
textarea {
width:400px;
height:150px;
}
.textinput {
width:250px;
}
fieldset {
border:#000 1px solid;
margin-top:40px;
}
.warning {
font-weight:bold;
color:#ff0000;
}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<h2>Contact Us </h2>
<?php
if ($_POST && !$mailSent) {
?>
<p class="warning">Sorry something went wrong when sending your message. Please try again. If your problem persists please contact your system admin or try again later. </p>
<?php
}
elseif ($_POST && $mailSent) {
?>
<p><strong>Your message has been sent. We will do everything we can to reply as fast as possible</strong></p>
<?php } ?>
<p>Please fill in your required message below and fill out all fields. We will aim to reply to your message as fast as possible.</p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form1" id="form1">
<fieldset>
<legend>Your Details</legend>
<p>
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
</p>
<p>
<label for="email">E mail:</label>
<input type="text" name="email" id="email" />
</p>
<p>
<label for="Tel">Tel.</label>
<input type="text" name="Tel" id="Tel" />
</p>
</fieldset>
<fieldset>
<legend>Your Message</legend>
<p>
<label for="message">Your Message:</label>
<textarea name="message" id="message" cols="45" rows="5"></textarea>
</p>
<p>
<input type="submit" name="Send" id="Send Message" value="Send message" />
</p>
</fieldset>
</form>
<p> </p>
</body>
</html>
i am new this and this is my first php script. I plut to together the simple script that i wast to send the form information to my email address. all as i can seem toget when submit is clicked is the error message i implememnted below.
[php]
<?php if ($_POST && !$mailSent) { ?>Sorry something went wrong when sending your message. Please try again. If your problem persists please contact your system admin or try again later.
[/php]i am sure that this is something very simple but im very new to this and cant see it. Any light shed on this would greatly be appreciated.
regards,
karl