Contact form with php [DOESN'T SEND]
Posted: Fri Dec 05, 2008 12:12 am
This is an email script for a contact form[it has the form on one page and the code on the next]
1st Page[its a added to the page by a database]
2nd page[send.php]:
THE PROBLEM:
It doesn't send on the send.php page, please help =]
1st Page[its a added to the page by a database]
Code: Select all
EMAIL DOESN't WORK at the moment sorry!
<form id="Send" name="Send" method="post" action="send.php">
<table width="176" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td colspan="2"><h1>Contact Us</h1></td>
</tr>
<tr>
<td width="70">Name:</td>
<td width="106"><label>
<input type="text" name="name" id="name" tabindex="1" />
</label></td>
</tr>
<tr>
<td>Email:</td>
<td><label>
<input type="text" name="email" id="email" tabindex="2" />
</label></td>
</tr>
<tr>
<td>Subject:</td>
<td><select name="subject" id="subject">
<option value="none~">Please Select a Subject</option>
<option value="General">General</option>
<option value="Website Quote">Website Quote</option>
<option value="Question?">Question?</option>
<option value="Broken Link?">Broken Link?</option>
<option value="Bug/Error">Bug/Error</option>
<option value="Other">Other</option>
</select>
</td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name="message" rows="3" wrap="virtual" id="textfield"></textarea></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="button" id="button" value="Send Email" tabindex="3" />
</label></td>
</tr>
</table>
</form>Code: Select all
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="i-style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div align="center">
<?php
// check for a valid enmail and make sure its not spam
function spamcheck($formfield)
{
$formfield = filter_var($formfield, FILTER_SANITIZE_EMAIL);
if(filter_var($formfield, FILTER_VALIDATE_EMAIL))
{
return TRUE;
}
else
{
return FALSE;
}
}
if (isset($_POST["email"]))
{
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "<h2>Invalid input, <a href='i-page.php?pagelink=4'>go back</a></h2>";
}
else
{
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$name = $_POST["name"];
mail("james@think-designs.net", "Subject: $subject", $message, "From: $email" );
echo '<h2><b>Thank you ' . $name . ' Your email has been sent!</b></h2>';
}
}
else
{
echo "Sorry you didn't completly fill out the email form, please go back and fill it out<br /><a href='i-page.php?pagelink=4'> << Go Back</a>";
}
?>
</div>
</body>
</html>
It doesn't send on the send.php page, please help =]