still having problems with submit form<

liunx

Guest
Hi again,

I still have problems with regards to my submit form.

everything is ok accept I want to be able to send the user who filled the form out to recieve an email saying thankyou.

But at the moment it just sends me all the information (which is not a problem).

Here is the page <!-- w --><a class="postlink" href="http://www.richsolutions.co.uk">www.richsolutions.co.uk</a><!-- w -->

and here is the txtmailer.php


<?
$address = <!-- e --><a href="mailto:'[email protected]">'[email protected]</a><!-- e -->';
$subj = 'support';
$returnto = 'thanks.html';

//////////////

$address = ($_POST['sendto'])?$_POST['sendto']:$address;
$subj = ($_POST['subject'])?$_POST['subject']:$subj;
$returnto = ($_POST['returnto'])?$_POST['returnto']:$returnto;
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=http://www.htmlforums.com/archive/index.php/"java script: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=http://www.htmlforums.com/archive/index.php/"java script:history.back()">Back</a></center></body></html><?
}

?>



I hope someone can help

Thanks

Lofttythen just add another one to it

mail($email, "Thnak you, $message2,"From: ".$address)) {Hi, your using that form? Well what he said should work. give it a shot.I have tried it and it is not working, maybe I have got it on the wrong line. What line should I have it on?

Thanks

Loftty// send email to user
mail($email, "Thank you", $message2,"From: ".$address);
$message = stripslashes($message);
// send email to you
if (@mail($address, $subj, $message,"From: ".$email)) {
if ($returnto) {
header('Location: '.$returnto);
}Hi,

I have tried what you told me to but I get both of the messages sent to the same address ie <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->, and also the email that is ment to be sent to them has no text in it. What am I doing wrong here?

Thanks

Loftty

PS. try it yrself and see if you get an email back.ok, look real close.

// send email to user
mail($email, "Thank you", $message2,"From: ".$address);
$message = stripslashes($message);
// send email to you

if you entered a email address the same as the one you send the $subj to, then you will get two. the bold variable will have to be made as you want it to say thankyou or something. look at the email address you send to, the first variable in the mail function, they are different.

one goes to you
$address = <!-- e --><a href="mailto:'[email protected]">'[email protected]</a><!-- e -->';

and one goes to what ever email was entered into the form
$email = $_POST['email'];

you have to make a message for teh one tha tgoe to the user, the thankyou message.Hi,

Thanks for that I have managed to get the email sent with a thankyou letter in it, I am still having trouble with sending the thankyou email to there address, how can I get the email they have entered recieve the thankyou email? there must be away where I have to get the text from the text field?

Thanks

Lofttyit is already there.

$email = $_POST['email'];

tha tis what they enter. I already put that in the email. so it will send to them as well. try it with a different email so you don't get 2 for the same one.
 
Back
Top