View Single Post
Old 09-30-2005, 08:15 PM   · #1
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 
Name: Eric
Location: Kentucky
Trader Rating: (137)
Join Date: Mar 2005
Posts: 4,118
NP$: 261.00 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
Member of the Month
MOTM September 2005 Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
Simple Contact Form

I've wrote a simple contact form/script. Email validation etc. Hope you like it.

contact.php
PHP Code:
<?php

/*
SVs SimpContact v1.0.0
Copyright © 2005 SecondVersion
http://www.secondversion.com
*/

echo 'You can use the following form to contact us.
<br>
All fields required.
<br>
<form method="post" action="contact.php">
Name:
<br>
<input type="text" name="name" size="20">
<br>
<br>
E-mail address:
<br>
<input type ="text" name="email" size="20">
<br>
<br>
Subject:
<br>
<input type ="text" name="sub" size="20">
<br>
<br>
Message:
<br>
<textarea rows="5" cols="35" name="message" wrap="virtual"></textarea>
<br>
<input type="submit" name="submit" value="Submit">
<br>
<br>
Powered by: <a target="_blank" href="http://www.secondversion.com">SVs SimpContact v1.0.0</a>.
</form>'
;

if(!empty(
$_POST['submit']))
{

$name = $_POST['name'];
$message = $_POST['message'];
$email = $_POST['email'];
$sub = $_POST['sub'];
$ip = $_SERVER['REMOTE_ADDR'];

//Check for a valid email..
$validate = eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$", $email);

if(!
$validate)
{
echo(
"<br>" . $email . " is not a valid email.");
}
else
{
$e = $email;
}

//Required Fields, you can add or remove fields as neccessary.
//Did they leave them empty?

if(!$name || !$message || !$e)
{
echo
'<br>One or more required fields were left blank, please enter all required data.';
}
else
{

//Get the date...
$date = date("M d Y");

//What email do you want it sent to?
$youremail = "you@domain.com";

//What subject to do want the email to be?
$subject = "Subject";

//Send the data...
$name = stripslashes($name);
$subj = stripslashes($sub);
$message = stripslashes($message);
$msg = wordwrap($message, 70, "<br>");

$headers = 'From: '.$e.'';
$send = mail("$youremail", "$subject","

<b>Name:</b> $name

<b>E-mail address:</b> $e

<b>Subject:</b> $subj

<b>Message:</b>
$msg

<b>Message sent on:</b> $date
<b>IP:</b> $ip

"
, $headers);

if(
$send)
{
echo
'<br>Thanks for contacting us.';
}
else
{
echo
'<br>Seems to be a problem, please try again later.';
}
}
}
?>

</body>
</html>


Enjoy!

-Eric


Please register or log-in into NamePros to hide ads
__________________
SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.1 now available!!
MetaCreator.com - Free Meta Tag Creator
SecondVersion is offline   Reply With Quote
Site Sponsors
Custom Logo Design Build your NameBrand Custom Logo Design
Advertise your business at NamePros
All times are GMT -7. The time now is 03:36 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.