View Full Version : html programming question
danns
Dec 4th, 2008, 07:21 PM
Hi guys,
I want to have a sheet where one can fill in information and when they click the submit button it sends the information directly to my email.
However what happens is that when they click on the submit button their email client opens up instead. What code should i put so when they click submit it sends it directly to my email, and they see the thank you page.
Currently I use the "mailto" command in html.
Thanks guys
ItemFinder
Dec 4th, 2008, 07:23 PM
html is not programming.
darius_m5
Dec 4th, 2008, 07:45 PM
From what I remember, you would need a form
e.g. form.html
<html><body>
<form method="POST" action="mail.php">
Name: <input type="text" name="Name" size="20"><br>
Email: <input type="text" name="Email" size="20"><br>
Subject: <input type="text" name="Subject" size="20"><br>
Message:<textarea rows="10" name="Message" cols="30"></textarea><br>
<input type="submit" value="Submit" name="Hello">
</form>
</body></html>
then the action of that form would submit the POST to some PHP or ASP code.
e.g. mail.php
<?php
$ToAddress = "email@youremail.com";
$message .= "-------------------------------------------\n";
foreach ($_POST as $key => $value){$message .= "$key: $value\n";}
$message .= "-------------------------------------------\n";
mail("$ToAddress",
"Message from web",
"\r\n".$message,
"From: $ToAddress\r\nCc:\r\nBcc:\r\n\r\n");
?>
<html>
<head>
<META HTTP-EQUIV="Refresh"
CONTENT="5; URL=index.php">
</head>
<body>
<p><big>This is the message they will see<big></p>
<p><b>You will be redirected in 5 seconds</b></p>
</body>
bimmer009
Dec 4th, 2008, 07:51 PM
You can't do that with *just* HTML. You need to also use a server-side scripting language like PHP, ASP, etc. Depending on your web host, there are various options available.
Here's a quick PHP tutorial on how to do what you want:
http://www.thesitewizard.com/archive/feedbackphp.shtml
akbar_k
Dec 5th, 2008, 05:05 AM
html is not programming.
How pedantic.
ipxxx
Dec 5th, 2008, 07:43 AM
you can't do that with *just* html. You need to also use a server-side scripting language like php, asp, etc. Depending on your web host, there are various options available.
Here's a quick php tutorial on how to do what you want:
http://www.thesitewizard.com/archive/feedbackphp.shtml
+1
cdnNick
Dec 5th, 2008, 12:13 PM
You need a form mailer to do this. The mailto command basically tells the mail client to open and address a new email message to the included address.
Something like this: http://www.dagondesign.com/articles/secure-php-form-mailer-script/
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.