Well you would certainly need a server-side script.
Here is a PHP script that would do it:
include three hidden fields in your html form:
<input type='hidden' name='email' value='
[email protected]' />
<input type='hidden' name='redirect' value='http://page.togoto.com' />
<input type='hidden' name='subject' value='This message subject'>
These fields may also be left off and specified in the PHP program itself.
Code:
<?php
# auto-mailer.php
# If the email is not specified, set it here
# Will default to [email protected]
#
# To set it to something else do this:
# $_POST["email"] = "[email protected]";
if (!isset($_POST["email"]))
$_POST["email"] = "webmaster@".$_SERVER["SERVER_NAME"];
# If the subject is not specified, set it here
if (!isset($_POST["subject"]))
$_POST["subject"] = "Your form results.";
# If the redirect to page is not specified, set it here
# page will redirect to the root www directory for the domain
if (!isset($_POST["redirect"]))
$_POST["redirect"] = "http://".$_SERVER["HTTP_HOST"];
$mail_body = (string) "The following was submitted on ".gmdate("M d Y H:i:s")."\n\n";
# Dump all fields into the message body
if (isset($_POST) && !empty($_POST))
{
foreach($_POST as $key => $value)
{
if ($key != "email" && $key != "subject" && $key != "redirect")
$mail_body .= $key.": ".stripslashes($value)."\n\n";
}
}
else
{
$mail_body .= "There was no data submitted!";
}
# Send the message
if (!mail($_POST["email"], $_POST["subject"], $mail_body, "From: {$_POST["email"]}"))
{
echo "Mailer failed! Please check your server's mail settings.";
}
else
{
# redirect to the specified location
header("Location: {$_POST["redirect"]}");
}
?>
Save this file with a PHP extension. Like mailer.php, or whatever you want and then specify the action attribute of the form tag to reference the same file and the method attribute to 'post':
<form method='post' action='mailer.php'>
...
All of this, of course, requires that you have a PHP-enabled web server.
: )
Rich
:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::