Hey i got it to work. here is the new code for future reference:
<?php
function spamcheck($field)
{
//filter_var() sanitizes the e-mail
//address using FILTER_SANITIZE_EMAIL
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
//filter_var() validates the e-mail
//address using FILTER_VALIDATE_EMAIL
if(filter_var($field, FILTER_VALIDATE_EMAIL))
{
return TRUE;
}
else
{
return FALSE;
}
}
if (isset($_REQUEST['email']))
{//if "email" is filled out, proceed
//check if the email address is invalid
$mailcheck = spamcheck($REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "<h2>Woe! Thats not an email address. Please <a href=\"contact.php\">go back</a> and try again.</h2>";
}
else
{//send email
$email = $REQUEST['email'] ;
$subject = $REQUEST['subject'] ;
$message = $REQUEST['message'] ;
mail("my@email.com", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
}
else
{//if "email" is not filled out, display the form
echo "<form action=\"contact.php\" method=\"post\">
<h2>Contact Form</h2>
<dl>
<dt><label>Full Name</label></dt>
<dd><input name='subject' type='text' class='form' size='25' />
</dd>
<dt><label>Email</label></dt>
<dd><input name='email' type='text' class='form' size='25' />
</dd>
<dt><label>Phone</label></dt>
<dd><input name='message' type='text' class='form' size='25' />
</dd>
<dt><label>Comments</label></dt>
<dd><textarea class='form' name='message' rows='5' cols='25'></textarea>
</dd>
<dd><input name='submit' type='submit' class='submit' value='Submit' align='right' /></dd>
</dl>
</form>";
} ?>
It works on my server which is the important thing. But for some reason, my local server on my mac osx 5 wont send it. I know i have to tweak the php.ini file. But that scares me. does anyone know what i need to do?