mail form

All about creating websites!
Post Reply
User avatar
n3rd
Staff Member
Staff Member
Posts: 1474
Joined: 15 Nov 2005, 17:00
18
Location: my own perfect world in ma head :)
Contact:

mail form

Post by n3rd »

Code: Select all

form id="form1" action="mailto:becauseimworhtitjustcusIcan" method="post" enctype="multipart/form-data" name="form1">
							div class="form">input type="text" value="Name:">/div>
							div class="form">input type="text" value="E-mail:">/div>
							textarea rows="40" cols="50">Message:/textarea>br>
							br style="line-height:8px">
							span >a href="#" onClick="document.getElementById('form1').reset()" style="margin-left:93px">Clear</a><a href="#" onClick="document.getElementById('form1').submit()" style="margin-left:12px">Send</a>/span>
							/form>
I want this script to be sent directly from my site to my email box, however my computer starts up my email client, how to fix this script.

I removed certain things to post this script.
[img]http://img580.imageshack.us/img580/8009/userbar2k.png[/img]

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

Code: Select all

action="mailto:becauseimworhtitjustcusIcan"
"mailto:" always opens the default email client, you have to use an external mail script (PHP one) as "action" and submit the form input data to it by setting IDs for the form fields, like:

Code: Select all

input type="text" value="Name:" id="name"
the script looks like:

Code: Select all

<?



$name = $_POST["name"];
$address = $_POST["street"];
$city = $_POST["city"];
$zip = $_POST["ZIP];
$phone = $_POST["phone"];
$email = $_POST["email"];
$comments = $_POST["request"];


$today = date("M d, Y");
$recipient = "your@email.addy";
$subject = "request from my website";
$forminfo =
"Name: $name\n
Anschrift: $address\n
Wohnort: $city\n
PLZ: $zip\n
Telefon/Fax: $phone\n
Email: $email\n
Anfrage: $comments\n
Gesendet: $today\n\n";


if (eregi("\r",$email) || eregi("\n",$email)){
     die("Your a fag, Why??");
}
$formsend = mail("$recipient", "$subject", "$forminfo", "From: $email\r\nReply-to:$email");
?>
p.s. the "you're a fag"-part is for smartasses trying to use your domain as sender address...props to Mab for that.

User avatar
n3rd
Staff Member
Staff Member
Posts: 1474
Joined: 15 Nov 2005, 17:00
18
Location: my own perfect world in ma head :)
Contact:

Post by n3rd »

Hmm thanks BB I will try to see if I can implement it in to the webpage.
but currently I am at work :P.
[img]http://img580.imageshack.us/img580/8009/userbar2k.png[/img]

Post Reply