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("[email protected]","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 Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/ 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 Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351867 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 <[email protected]>' . "\r\n"; mail("[email protected]","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"); ?> Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351880 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(). Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351882 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.. Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351889 Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 <?php $to = '[email protected]'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\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. Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351890 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" Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351896 Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 The same way you were before.... Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351898 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 = '[email protected]'; $subject = 'Schofields enquiry form'; $message = 'help'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers "Location: http://www.mywebsite/Schofields Mortgages/Schofields_thankyou.htm"); ?> Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351912 Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 wtf... Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351913 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 Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351914 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 Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351919 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. Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351921 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 = '[email protected]'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); header("Location: http://www.mywebsite/Schofields_thankyou.htm"); ?> Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351922 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 Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351924 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. Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351925 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!) Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351926 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 Link to comment https://forums.phpfreaks.com/topic/70068-my-php-form-sends-a-nobody-in-thr-fromsender-field-of-my-email/#findComment-351927 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.