Home   News  Product reviews  Website reviews  Forums   Competitions  Subscribe 


Web Building >> Web design & build

 |  Print Thread
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><?
}

?>

Post Extras Print Post   Remind Me!     Notify Moderator
Rate this thread

Jump to


Entire topic
Subject Posted by Posted on
* Need help with forms on our website splash Tue Mar 13 2007 01:26 PM
. * * Re: Need help with forms on our website ianm   Tue Mar 13 2007 06:10 PM
. * * Re: Need help with forms on our website splash   Thu Mar 15 2007 07:10 PM
. * * Re: Need help with forms on our website splash   Fri Mar 16 2007 05:43 PM
. * * Re: Need help with forms on our website ianm   Fri Mar 16 2007 06:43 PM
. * * Re: Need help with forms on our website splash   Fri Mar 16 2007 07:30 PM
. * * Re: Need help with forms on our website ianm   Sat Mar 17 2007 07:43 AM
. * * Re: Need help with forms on our website splash   Sat Mar 17 2007 10:32 AM
. * * Re: Need help with forms on our website ianm   Sat Mar 17 2007 09:05 PM
. * * Re: Need help with forms on our website splash   Sat Mar 17 2007 11:26 PM
. * * Re: Need help with forms on our website ianm   Sat Mar 17 2007 11:59 PM
. * * Re: Need help with forms on our website splash   Sun Mar 18 2007 08:09 AM
. * * Re: Need help with forms on our website ianm   Sun Mar 18 2007 08:29 AM
. * * Re: Need help with forms on our website splash   Sun Mar 18 2007 10:32 AM
. * * Re: Need help with forms on our website ianm   Sun Mar 18 2007 11:21 AM
. * * Re: Need help with forms on our website splash   Sun Mar 18 2007 02:09 PM
. * * Re: Need help with forms on our website ianm   Sun Mar 18 2007 07:19 PM
. * * Re: Need help with forms on our website splash   Sun Mar 18 2007 07:49 PM
. * * Re: Need help with forms on our website ianm   Mon Mar 19 2007 11:36 PM
. * * Re: Need help with forms on our website splash   Thu Mar 22 2007 07:04 AM
. * * Re: Need help with forms on our website ianm   Thu Mar 22 2007 11:53 PM

Extra information
0 registered and 7 anonymous users are browsing this forum.

Moderator:  putasolutions, Joe_London, greysts, bricat, Nanook, Hello_There, John_McKenna, Mouse, TheFatControlleR 


Print Thread
Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      Mark-up is enabled

Rating:
Thread views: 0

Contact Us | Privacy statement Main website