Bobski2000 Posted February 22, 2009 Share Posted February 22, 2009 Hi guys, I'm really new to this and would love a little bit of help if possible. Me and a few others have a website where i've made this form, in Dreamweaver, so that others can join. The problem is i've looked for a script to make the form work and upto now i just cannot get it to work. Once i've clicked on the send now button i run the script (Which is at the bottom) No email comes to me. Have a done something wrong? Our signup page is www.fubarlegion.org/signup so you can check out our signup page. The Script:- <?php /* Subject and email varibles */ $emailSubject = 'Fubar Application'; $webMaster = '[email protected]'; /* Gathering data Variables */ $usernameField = $_POST['username']; $nameField = $_POST['name']; $emailField = $_POST['email']; $findingusField = $_POST['findingus']; $rssfieldField = $_POST['rssfield']; $commentsField = $_POST['comments']; $body = <<<EOD <br><hr><br> Username: $username <br> Name: $name <br> Email: $email <br> How Did You Finding Us: $findingus <br> Rss Yes Or No: $rssfield <br> Comments: $comments <br> EOD; $headers = "From: $emailFeild\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webmaster, $emailSubject, $body, $headers); /* Results Rendered as html */ $theResults = <<<EOD <html> <head> <title>F.U.B.A.R Sign up Page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-color: #f1f1f1; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } --> </style> </head> <div> <div align="left">Thank you for your interest! Your email will be answered very soon!</div> </div> </body> </html> EOD; echo "$theResults"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/146357-php-script-just-does-not-work/ Share on other sites More sharing options...
redarrow Posted February 22, 2009 Share Posted February 22, 2009 $emailField << post email to the user i guess is wrong and not right on your email code change it. is this what you ment dont no you tell me. <?php $success = mail($emailField , $emailSubject, $body, $headers); ?> this should be added as a FROM: header field i am guessing. $webMaster = '[email protected]'; Quote Link to comment https://forums.phpfreaks.com/topic/146357-php-script-just-does-not-work/#findComment-768394 Share on other sites More sharing options...
Bobski2000 Posted February 22, 2009 Author Share Posted February 22, 2009 hi, Having read your post, i noticed that my webmaster shuld have been webMaster with a capital M. The email no delivers but no content! I understand what i'm writing but not on how it works..lol.. Any ideas on the content? Dave Quote Link to comment https://forums.phpfreaks.com/topic/146357-php-script-just-does-not-work/#findComment-768396 Share on other sites More sharing options...
Bobski2000 Posted February 22, 2009 Author Share Posted February 22, 2009 oopss, double post... Quote Link to comment https://forums.phpfreaks.com/topic/146357-php-script-just-does-not-work/#findComment-768397 Share on other sites More sharing options...
Cal Posted February 22, 2009 Share Posted February 22, 2009 $success = mail($emailField , $emailSubject, $body, $headers); You haven't defned $body, that is why there is no content, maybe you wrote the wrong variable. Quote Link to comment https://forums.phpfreaks.com/topic/146357-php-script-just-does-not-work/#findComment-768398 Share on other sites More sharing options...
Bobski2000 Posted February 22, 2009 Author Share Posted February 22, 2009 I thought i had.... $body = <<<EOD <br><hr><br> Username: $username <br> Name: $name <br> Email: $email <br> How Did You Finding Us: $findingus <br> Rss Yes Or No: $rssfield <br> Comments: $comments <br> EOD; Quote Link to comment https://forums.phpfreaks.com/topic/146357-php-script-just-does-not-work/#findComment-768404 Share on other sites More sharing options...
Cal Posted February 22, 2009 Share Posted February 22, 2009 Try: $body = " <br><hr><br> Username: $username <br> Name: $name <br> Email: $email <br> How Did You Finding Us: $findingus <br> Rss Yes Or No: $rssfield <br> Comments: $comments <br> "; Quote Link to comment https://forums.phpfreaks.com/topic/146357-php-script-just-does-not-work/#findComment-768408 Share on other sites More sharing options...
Bobski2000 Posted February 22, 2009 Author Share Posted February 22, 2009 Whilst reading the script again i noticed a School Boy ErroR. In the $body = <<<EOD All the $ are wrong. Instead of $username it should be $usernameField My god I need those stupid pills again. Thanks guys for the help. I would have been knocking myself out over this.. Cheers Again. Dave Quote Link to comment https://forums.phpfreaks.com/topic/146357-php-script-just-does-not-work/#findComment-768409 Share on other sites More sharing options...
redarrow Posted February 22, 2009 Share Posted February 22, 2009 kindly tell us did this way off formatting your code with heredoc work with the email function. <?php $body = <<<EOD <br><hr><br> Username: $username <br> Name: $name <br> Email: $email <br> How Did You Finding Us: $findingus <br> Rss Yes Or No: $rssfield <br> Comments: $comments <br> EOD; ?> Quote Link to comment https://forums.phpfreaks.com/topic/146357-php-script-just-does-not-work/#findComment-768422 Share on other sites More sharing options...
Bobski2000 Posted February 22, 2009 Author Share Posted February 22, 2009 Like i said i completely wrote the $ wrong. they all needed the full string names. $username should have been $usernameField etc... heredoc? is that a form of php stuff? I got the original script from tutvid.com but even he did it wrong, and with your help guys i've sorted it. Ta Dave Quote Link to comment https://forums.phpfreaks.com/topic/146357-php-script-just-does-not-work/#findComment-768427 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.