markarma Posted April 16, 2009 Share Posted April 16, 2009 Hi The following code works perfectly well on my site, hosted by Streamline.net, however I've been trying for about 3 days to simply add a 'Your Name' field and also send that info to my inbox, it just doesn't work. ANy help much appreciated! HTML... <FORM method=post action="sendmail.php"> Email: <br> <INPUT name="email" type="text"><br> Message:<br> <TEXTAREA name="message"></textarea><br> <input type=submit> </FORM> PHP... <?php mail("mark@markarma.com", "This is the subject of the email", "Message: " .$_REQUEST[message]."\n", "From: " .$_REQUEST, "-f".$_REQUEST); header( "Location: http://www.markarma.com" ); ?> Thanks, Mark Quote Link to comment https://forums.phpfreaks.com/topic/154335-solved-fancy-a-simple-challenge/ Share on other sites More sharing options...
MasterACE14 Posted April 16, 2009 Share Posted April 16, 2009 Your Name: <br> <INPUT name="name" type="text"><br> "From: $_REQUEST[name] . " " . $_REQUEST[email], Quote Link to comment https://forums.phpfreaks.com/topic/154335-solved-fancy-a-simple-challenge/#findComment-811379 Share on other sites More sharing options...
markarma Posted April 16, 2009 Author Share Posted April 16, 2009 Thanks for your prompt response. It has given me this error message... Parse error: syntax error, unexpected '"' in /home/fhlinux195/m/markarma.com/user/htdocs/en/sendmail.php on line 11 (line 11 is where i posted your PHP code) Quote Link to comment https://forums.phpfreaks.com/topic/154335-solved-fancy-a-simple-challenge/#findComment-811381 Share on other sites More sharing options...
jesushax Posted April 16, 2009 Share Posted April 16, 2009 try this XHTML strict option for your html and better formatting for your php HTML <form method="post" action="sendmail.php"> Your Name: <br /> <input type="text" name="YourName" /> Email: <br /> <input name="email" type="text"><br> Message: <br /> <textarea name="message"></textarea><br> <input type="submit"> </form> <?php $to = "mark@markarma.com"; $subject = "This is the subject of the email"; $message = " <html> <head> <title>HTML email</title> </head> <body>"; $message .= "Message From:"; $message .= $_POST["YourName"]; $message .= "Message:"; $message .= $_POST["message"]; $message .= "From: "; $message .= $_POST["email"]; $message .= " </body> </html> ";// Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: <$email>' . "\r\n"; mail($to,$subject,$message,$headers); header( "Location: http://www.markarma.com" ); exit(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/154335-solved-fancy-a-simple-challenge/#findComment-811382 Share on other sites More sharing options...
markarma Posted April 16, 2009 Author Share Posted April 16, 2009 THanks Jesushax but it isn't working, it doesn't give an error message but no message comes through? I dont understand how my basic code can work, yet adding a simple thing to it just stops it working ? Quote Link to comment https://forums.phpfreaks.com/topic/154335-solved-fancy-a-simple-challenge/#findComment-811389 Share on other sites More sharing options...
jesushax Posted April 16, 2009 Share Posted April 16, 2009 ok can you do the below changes echo "<p>This is the Message:".$message."</p>"; //header( "Location: http://www.markarma.com" ); exit(); where commenting out the header so we can see whats posted from the message can you post the output of this is the message.. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/154335-solved-fancy-a-simple-challenge/#findComment-811410 Share on other sites More sharing options...
markarma Posted April 16, 2009 Author Share Posted April 16, 2009 Thanks for everyones help, I did a search within the forum and found what I was looking for by searching for 'streamline.net'. http://www.phpfreaks.com/forums/index.php/topic,189288.0.html I was able to borrow and edit the code discussed on the page. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/154335-solved-fancy-a-simple-challenge/#findComment-811460 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.