jamosdeyamos Posted October 2, 2008 Share Posted October 2, 2008 Hey all, I'm trying to make a form on my website so I can let people join a mailing list. I wanted the results emailed to me so it was suggested I use PHP. I tried inputting this PHP off of http://php.about.com/od/phpapplications/ss/form_mail.htm but they didnt explain it as though I was didn't understand PHP, so I'm pretty sure I messed it up. Here's the form I have on my webpage: <form method="post" action="maillist.php"><font bgcolor="C1C1C1" size="1" color="#ffffff" face="helvetica">Email: <input name="email" type="text"><br> <br>What information would you like to recieve?<br> Shows? <input value="Yes" name="shows" type="checkbox"> Contests? <input value="yes" name="contests" type="checkbox"><br> <br><input value="Join Now!" type="submit"></form> And heres the maillist.php file... <?php $to = "[email protected]"; $subject = "Add to mailing list..."; $email = $_REQUEST['email'] ; $shows = $_REQUEST['shows'] ; $contests = $_REQUEST['contests'] ; $headers = "From: [email protected]"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> The weirdest part is that the form connects, and sends the email address an email with the subject right and everything. But then the email is entirely blank. So I presumed there was something wrong with my $_REQUEST tag, but I'll be damned if I can figure out what it is. If anyone can help me, that would be awesome. I'm fairly interested in learning PHP and becoming part of the fold, but this is something I can't really afford to wait for. Thanks! James PS, the website its trying to go on is www.metheusbound.ca Link to comment https://forums.phpfreaks.com/topic/126786-php-noob-needs-form-help/ Share on other sites More sharing options...
revraz Posted October 2, 2008 Share Posted October 2, 2008 It's empty because $message is empty. Your code isn't putting anything in the $message variable. Link to comment https://forums.phpfreaks.com/topic/126786-php-noob-needs-form-help/#findComment-655773 Share on other sites More sharing options...
jamosdeyamos Posted October 2, 2008 Author Share Posted October 2, 2008 great thanks! uhm... what should I put in it? this is what it said on the page, but I didnt know how to do what it was asking: "Collect the message and email fields from the form and assign them to variables" Link to comment https://forums.phpfreaks.com/topic/126786-php-noob-needs-form-help/#findComment-655775 Share on other sites More sharing options...
revraz Posted October 2, 2008 Share Posted October 2, 2008 You should put in it whatever you want sent to you. Link to comment https://forums.phpfreaks.com/topic/126786-php-noob-needs-form-help/#findComment-655779 Share on other sites More sharing options...
jamosdeyamos Posted October 2, 2008 Author Share Posted October 2, 2008 awesome, it just clicked what that whole line was about, haha. Thanks! Link to comment https://forums.phpfreaks.com/topic/126786-php-noob-needs-form-help/#findComment-655787 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.