Forum Moderators: mack

Message Too Old, No Replies

E-mail form results

         

Webber

5:04 pm on Dec 12, 2004 (gmt 0)

10+ Year Member



I want to make a form on my site.

The results of this form should go to my email adress. I do not want to use "mailto", because most people do not have this option, but have a hotmail account or something alike.

How should I do this? Can I attach an e-mail account to this form, so all results arrive in my mailbox coming from a single email address?

And how to write it in HTML?

kodaks

5:44 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are two main ways to process and write forms:

-Find a third party that will do the hard work for you (ussually for free)

-Code it yourself. If you want to take this approach, then first you need to know how to make a form:
[w3schools.com...]

When you have finished making the form, you must find a way to process it. This can be done using a third party (google to find one [google.ca]), or a script that you can download.

If you choose the script, I would recommend the Jack's Formmail Script, which is free and uses PHP.

benevolent001

5:49 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi webber
Here is what you need,just place this code in php file place the form on your website and allow this mailer.php to handle it.
With Regards

<?PHP
$to = "my@email.com";
$subject = "New contact";
$headers = "From:Mywebsite";
$forward = 1;
$location = "newthanks.htm";

$date = date ("l, F jS, Y");
$time = date ("h:i A");

$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thanks! . We will get back to you as soon as possible.";
}

?>

MichaelBluejay

9:17 am on Dec 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't know PHP (I use Perl), but is that form secure from spam hijackers?