Porkie Posted March 26, 2009 Share Posted March 26, 2009 hey i have a mailing list form and was wondering why it doesnt actually work, the error is, Parse error: syntax error, unexpected $end in /home/sjah/public_html/mail.php on line 22 and was wonderin whether the error was ? cheers in advance [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/151257-very-simple-coding-problem/ Share on other sites More sharing options...
waynew Posted March 26, 2009 Share Posted March 26, 2009 Hi, you forgot to close off your IF statement in mail.php Change the code to: <?php if(isset($_POST['submit'])) { $to = $_POST['emailfield']; $namefield = $_POST['namefield']; $message = "Test"; $subject = "Amity Mailing List : Thanks $namefield for registering your interest into our band"; $body = "$message"; mail($to, $subject, $body); } ?> Link to comment https://forums.phpfreaks.com/topic/151257-very-simple-coding-problem/#findComment-794559 Share on other sites More sharing options...
FaT3oYCG Posted March 26, 2009 Share Posted March 26, 2009 mail.php - you missed the } to close the if statment <?php if(isset($_POST['submit'])) { $to = $_POST['emailfield']; $namefield = $_POST['namefield']; $message = "Test"; $subject = "Amity Mailing List : Thanks $namefield for registering your interest into our band"; $body = "$message"; mail($to, $subject, $body); } ?> Link to comment https://forums.phpfreaks.com/topic/151257-very-simple-coding-problem/#findComment-794560 Share on other sites More sharing options...
Porkie Posted March 26, 2009 Author Share Posted March 26, 2009 cheers for the quick replies guys , most appreciated. However once users have submitted they just get a white screen. I have created a page which once registation has been sucessful they will be sent to. What code would i insert to send them to that page. The page is called "Sucess.php". and i need to use the $namefile and $emailfield on the sucess.php page. how could this be possible ? Cheers Link to comment https://forums.phpfreaks.com/topic/151257-very-simple-coding-problem/#findComment-794576 Share on other sites More sharing options...
kickstart Posted March 26, 2009 Share Posted March 26, 2009 Hi Try this:- header("Location: Sucess.php?emailfield=$to&namefield=$namefield"); All the best Keith Link to comment https://forums.phpfreaks.com/topic/151257-very-simple-coding-problem/#findComment-794583 Share on other sites More sharing options...
Porkie Posted March 26, 2009 Author Share Posted March 26, 2009 going back to the contact.php and mail.php , i still arent recieving an email, it goes through but i dont recieve anything in my inbox why is this? also thanks keith for your code it works however how do i get it to load the $emailvariable in a sentence ? Example "Thanks For Registeration $namefield" How can i get that to work ? Cheers Link to comment https://forums.phpfreaks.com/topic/151257-very-simple-coding-problem/#findComment-794611 Share on other sites More sharing options...
kickstart Posted March 26, 2009 Share Posted March 26, 2009 Hi You can put the fields on the end and they will be passed through to the new script where you can get them from the $_GET array. All the best Keith Link to comment https://forums.phpfreaks.com/topic/151257-very-simple-coding-problem/#findComment-794687 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.