mightymouse Posted September 20, 2007 Share Posted September 20, 2007 Hi dont know that much about php. I have a form in my html page which is sent to a php file this file send the information to my email but it doesnt put a name in the sender field im shure its going to be easy for you guys. this is the code I have... <?php mail("myemail@yahoo.com","Schofields enquiry from \n".$_REQUEST['yourname'],"\n\nTel:\n".$_REQUEST['yourtel']."\n\nThis is the sender\n".$_REQUEST['youremail']."\n\nIam interested in a \n".$_REQUEST['mortgage']); header ("Location: http://www.mywebsite/Schofields_thankyou.htm"); ?> this is what it looks like when it arrives in the email From Subject Nobody zebra enquiry from martin Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 You never set the headers. check out the manual. http://www.php.net/manual/en/function.mail.php Quote Link to comment Share on other sites More sharing options...
mightymouse Posted September 20, 2007 Author Share Posted September 20, 2007 I have put this in but im getting the same I think this might be wrong <?php $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n"; mail("myemail@yahoo.com","Schofields enquiry from \n".$_REQUEST['yourname'],"\n\nTel:\n".$_REQUEST['yourtel']."\n\nThis is the sender\n".$_REQUEST['youremail']."\n\nIam interested in a \n".$_REQUEST['mortgage']); header ("Location: http://www.mywebsite/Schofields Mortgages/Schofields_thankyou.htm"); ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 The actual mail() command does not have that header. Follow example: Example 1115. Sending mail with extra headers. and just change the values, not what is being sent in mail(). Quote Link to comment Share on other sites More sharing options...
mightymouse Posted September 20, 2007 Author Share Posted September 20, 2007 sorry its 12.00pm at night and its not sinking in too well could you explain that a little.. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> Change the email address and message to what you want, but don't change the mail() line. Quote Link to comment Share on other sites More sharing options...
mightymouse Posted September 20, 2007 Author Share Posted September 20, 2007 thanks for your help I'm sure you'd rather be doing something else that worked fine BUT how do I redirect me page to "Location: http://www.mywebsite/Schofields_thankyou.htm" Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 The same way you were before.... Quote Link to comment Share on other sites More sharing options...
mightymouse Posted September 20, 2007 Author Share Posted September 20, 2007 Im lost I got the from field right but now im having trouble getting all the information from the form to send and still cant direct the php yo my thank you page what am I doing wrong <?php $to = 'myemail@yahoo.com'; $subject = 'Schofields enquiry form'; $message = 'help'; $headers = 'From: monkeysneagles@yahoo.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers "Location: http://www.mywebsite/Schofields Mortgages/Schofields_thankyou.htm"); ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 wtf... Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 20, 2007 Share Posted September 20, 2007 why are you putting header statement in your mailto? ??? you should mke it like if error dont send the form else mail then put the header Quote Link to comment Share on other sites More sharing options...
mightymouse Posted September 20, 2007 Author Share Posted September 20, 2007 I dont know thats why im here asking some questions I think ill revert to my old way and put up with nobody for the sender I think Ive pissed jessierose off Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 Dude the code was working fine, all you had to do was add back your line for the header('Location: ') and instead you stuck it somewhere in the middle of the mail command. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 20, 2007 Share Posted September 20, 2007 i dont think you "pissed" her off. i think just annoyed her atad. try <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); header("Location: http://www.mywebsite/Schofields_thankyou.htm"); ?> Quote Link to comment Share on other sites More sharing options...
mightymouse Posted September 20, 2007 Author Share Posted September 20, 2007 I've tried it but its not working I need some sleep and I probably need to read the manual before I post again thanks for the info Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 Yeah I'm not pissed off I just think if you don't see what the problem is there, you're attempting stuff that is above your erm...learning curve right now. Like, grab a book or two on PHP. Or even any programming language. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 20, 2007 Share Posted September 20, 2007 scuse me if im butting in but i thought i may advertise a few books 1. Spring into PHP 5 2. PHP fast and easy web development (yeah right haha!) Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 20, 2007 Share Posted September 20, 2007 mightymouse: i modified the code there is no if or else statement now. it should work fine it should send the mail and redirect to your thank you page is it not? let us know please Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.