this is the way you code should look like. You were not careful with the syntaxes used. Differenciate this with yours
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" />
<body>
PHP Code:
<?php
$name = $_POST['name'];
$sub = $_POST['sub'];
$address = $_POST['email'];
$msg = $_POST['msg'];
$ip = $_SERVER['REMOTE_ADDR'];
$mess = "
Subject: $sub \n
Message: $msg \n
From: $address \n
IP: $ip \n
";
if ( (!$name)||(!$sub)||(!$msg) ){
echo "Please fix the following:<BR>";
if(!$name){
echo "Please fill in your name<BR>";
}
if(!$sub){
echo "Please fill in the subject<BR>";
}
if(!$msg){
echo "Please fill in the message<BR><BR>";
}
echo('
<form action="contact.php" method="post">
Name: <input type="text" name="name" class="input"><BR>
Subject: <input type="text" name="sub" class="input"><BR>
E-mail <input type="text" name="email" class="input"><BR>
Message:
<textarea name="msg" rows="7" cols="50" class="input"></textarea>
<input type="submit" value="Send" class="button">
</form>');
} else {
mail("myaddress@mydomain.com", "Subject: $sub", $mess, "From: $name <$address>");
if(mail) {
echo "Thank you! Please wait up to 48 hours for a reply.";
} else {
echo "The message could not be sent. Please try again later.";
}
}
?>
HTML Code:
</body></html>
Bookmarks