|
|
ianm
regular
Reg'd: Fri
Posts: 348
Loc: Colchester
|
Re: Need help with forms on our website
Tue Mar 13 2007 06:10 PM
|
|
|
Your form can not send a the information as there is no script set to handle the information, I am going to take a gamble here and presume you have php installed on your server, if so here's how to make it work.
----Find------ <form name="form1" method="post" action="" enctype="multipart/form-data">
------Replace with---------- <form name="form1" method="post" action="txtmailer.php" enctype="multipart/form-data">
Copy the code below paste it into notepad or whatever text editor you use and change the 1st few lines to use your details, then save it as txtmailer.php if you use notepad then when you save as put the name txtmailer.php between "" to stop it getting a .txt extension. once done upload the new txtmailer.php to the same place where all you other webpages are and then test your form.
<?
// Default settings. Change these! $address = 'youremail@whatever.com'; // Default address you want mail sent to $subj = 'site feedback'; // Default subject to give to emails $returnto = 'homepage.html'; // Default page people should be redirected to after mailing
//////////////
// Override defaults $address = ($_POST['sendto'])?$_POST['sendto']:$address; $subj = ($_POST['subject'])?$_POST['subject']:$subj; $returnto = ($_POST['returnto'])?$_POST['returnto']:$returnto;
// if email address isn't present or is invalid, use TO address as FROM address. if (eregi('^.+@.+\.[a-z]{2,6}',$_POST['email'])) { $email = $_POST['email']; $message = "Auto Mail from ".$email."\n\n"; } else { $email = $address; $message = "Auto Mail from Anonymous\n\n"; } foreach ($_POST as $key => $val) { if ($key != 'returnto' && $key != 'email' && $key != 'subject' && $key != 'sendto') { $message .= $key.': '.$val."\n"; } } $message = stripslashes($message); if (@mail($address, $subj, $message,"From: ".$email)) { if ($returnto) { header('Location: '.$returnto); } else { ?><html><body><center><font color="green"><b>email sent!</b></font><p><a href="JavaScript:history.back()">Back</a></center></body></html><? } } else { ?><html><body><center><font color="red"><b>there was a problem sending the mail</b></font><p><a href="JavaScript:history.back()">Back</a></center></body></html><? }
?>
|
|
|
|
|