Thanks Djr!
But um how would you ajax page that and make that into one doc? like..
(Made the part bold)
contact.php
Code:
<form name="contact_us" id="contact_us" method="post" action="javascript:ajaxPage('contact.php', 'content');">
<strong>
<img src="" align="right" border="0">Name</strong> <br>
<input name="name" id="name" value="" type="text"> <br>
<br>
<strong>Email Address</strong> <br>
<input name="visitormail" id="visitormail" value="" type="text"> <br>
<br>
<strong>Subject</strong> <br>
<select name="subject" id="subject">
<option>Select One...</option>
<option>Option 1</option>
<option>Option 1</option>
<option>Option 3</option>
</select> <br>
<br>
<strong>Message</strong> <br>
<textarea name="message" id="message"></textarea>
<br> <br>
<input type="submit" value="Send!" name="submit" />
</form>
Put this code into the contact.php document instead of having contact.php and sendemail.php, so there is just contact.php
sendemail.php
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
$name = $_POST['name'];
$visitormail = $_POST['visitormail'];
$message = $_POST['message'];
$subject = $_POST['subject'];
if (eregi('http:', $message)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
if(empty($name) || empty($visitormail) || empty($message )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}
$todayis = date("l, F j, Y, g:i a") ;
$subject = $subject ;
$subject = $subject;
$message = stripcslashes($message);
$message = "
From: $name ($visitormail)\n
Message: $message \n
IP : $ip \n
";
$from = "From: $visitormail\r\n";
mail("mail@mail.com", $subject, $message, $from);
?>
</body>
</html>
Bookmarks