cfgcjm Posted September 30, 2007 Share Posted September 30, 2007 I have a form emailer in php that will not reach the success/failure page but does sent email successfully. I sends me to my requester.php file instead of requestsuccess.php Form Code <?php /* Is User Logged In? */ session_start(); // this is just your every day page where you would want someone logged in to view the info if ($_SESSION['loggedin'] == TRUE) { // user is logged in print ''; } elseif ($_SESSON['loggedin'] == FALSE) { // user is not logged in header("location:no.php"); // Use is not logged in. Send to notloggedinpage.php exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> .style1 { font-family: Verdana; font-size: x-small; text-align: center; } </style> </head> <body style="background-image: url('images/bkg.jpg')"> <div style="position: absolute; width: 403px; height: 208px; z-index: 1; left: 18px; top: 9px" id="layer1" class="style1"> <form name="form1" method="post" action="requester.php" style="width: 360px; height: 201px"> <table width="43%" border="0" align="center" cellpadding="1" cellspacing="1"> <tr> <td width="34%" align="right" valign="middle"><div align="right"><font size="2"><strong><font face="Arial, Helvetica, sans-serif">Name:</font></strong></font></div></td> <td width="66%"><font face="Arial, Helvetica, sans-serif"> <input name="name" type="text" id="name" size="40"> </font></td> </tr> <tr> <td align="right" valign="middle"> <p align="right"><font size="2"><strong><font face="Arial, Helvetica, sans-serif">E-Mail:</font></strong></font></p></td> <td><font face="Arial, Helvetica, sans-serif"> <input name="email" type="text" id="email" size="40" maxlength="40"> </font></td> </tr> <tr> <td align="right" valign="middle"><div align="right"><font size="2"><strong><font face="Arial, Helvetica, sans-serif">Person to add:</font></strong></font></div></td> <td><input name="person" type="text" id="person" value="" size="40"></td> </tr> <tr> <td align="right" valign="top"><div align="right"><font size="2"><strong><font face="Arial, Helvetica, sans-serif">Reason:</font></strong></font></div></td> <td><font face="Arial, Helvetica, sans-serif"> <textarea name="reason" cols="20" rows="4" id="reason" style="width: 287px"></textarea> </font></td> </tr> <tr> <td><font face="Arial, Helvetica, sans-serif"> </font></td> <td><font face="Arial, Helvetica, sans-serif"> <input name="Submit" type="submit" id="Submit" value="Submit"> <input name="Reset" type="reset" id="Reset" value="Reset"> </font></td> </tr> </table> </form> </div> </body> </html> Requester.php <? $name = $_POST["name"]; $email = $_POST["email"]; $person = $_POST["person"]; $reason = $_POST["reason"]; $today = date("d, M Y"); $recipient = "millercj@etown.edu"; $subject = "Prayer Request"; $forminfo ="Prom: $name\nEmail: $email\nForm Submitted: $today\nPerson to add: $person\nReason: $reason\n\n"; $sent = mail($recipient, $subject, $forminfo, "From: $email"); if($sent) { header("Location:http://www.stjohnsuccjonestown.org/portal/requestsuccess.php");} else { header("Location:http://www.stjohnsuccjonestown.org/portal/requestno.php"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/ Share on other sites More sharing options...
LiamProductions Posted September 30, 2007 Share Posted September 30, 2007 You want to send it to requestsuccess.php? <form name="form1" method="post" action="requester.php" style="width: 360px; height: 201px"> Change it to... <form name="form1" method="post" action="requestsuccess.php" style="width: 360px; height: 201px"> Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358607 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 no i want to send it to requester.php to process it and on success send it too requestsuccess.php Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358612 Share on other sites More sharing options...
LiamProductions Posted September 30, 2007 Share Posted September 30, 2007 I don't understand. Can you explain more?\ Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358613 Share on other sites More sharing options...
shocker-z Posted September 30, 2007 Share Posted September 30, 2007 What do you get on that page? Try this incase errors are turned off.. also ive added 2 echos to see if it's submitted but im sure it will be an error.. <? error_reporting('E_ALL'); $name = $_POST["name"]; $email = $_POST["email"]; $person = $_POST["person"]; $reason = $_POST["reason"]; $today = date("d, M Y"); $recipient = "millercj@etown.edu"; $subject = "Prayer Request"; $forminfo ="Prom: $name\nEmail: $email\nForm Submitted: $today\nPerson to add: $person\nReason: $reason\n\n"; $sent = mail($recipient, $subject, $forminfo, "From: $email"); if($sent) { header("Location:http://www.stjohnsuccjonestown.org/portal/requestsuccess.php"); echo 'success'; } else { header("Location:http://www.stjohnsuccjonestown.org/portal/requestno.php"); echo 'failed'; } ?> also do you receive the email?? Regards Liam Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358614 Share on other sites More sharing options...
LiamProductions Posted September 30, 2007 Share Posted September 30, 2007 oh right... Im not sure if this is what you mean? <? $name = $_POST["name"]; $email = $_POST["email"]; $person = $_POST["person"]; $reason = $_POST["reason"]; $today = date("d, M Y"); $recipient = "millercj@etown.edu"; $subject = "Prayer Request"; $forminfo ="Prom: $name\nEmail: $email\nForm Submitted: $today\nPerson to add: $person\nReason: $reason\n\n"; $sent = mail($recipient, $subject, $forminfo, "From: $email"); if($sent) { header("Location: portal/requestsuccess.php"); } else { header("Location: portal/requestno.php"); } ?> Try that you can only put where the document is in the header you can't put http://www.------.com Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358617 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 ok...there is a form whose code is <?php /* Is User Logged In? */ session_start(); // this is just your every day page where you would want someone logged in to view the info if ($_SESSION['loggedin'] == TRUE) { // user is logged in print ''; } elseif ($_SESSON['loggedin'] == FALSE) { // user is not logged in header("location:no.php"); // Use is not logged in. Send to notloggedinpage.php exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> .style1 { font-family: Verdana; font-size: x-small; text-align: center; } </style> </head> <body style="background-image: url('images/bkg.jpg')"> <div style="position: absolute; width: 403px; height: 208px; z-index: 1; left: 18px; top: 9px" id="layer1" class="style1"> <form name="form1" method="post" action="requester.php" style="width: 360px; height: 201px"> <table width="43%" border="0" align="center" cellpadding="1" cellspacing="1"> <tr> <td width="34%" align="right" valign="middle"><div align="right"><font size="2"><strong><font face="Arial, Helvetica, sans-serif">Name:</font></strong></font></div></td> <td width="66%"><font face="Arial, Helvetica, sans-serif"> <input name="name" type="text" id="name" size="40"> </font></td> </tr> <tr> <td align="right" valign="middle"> <p align="right"><font size="2"><strong><font face="Arial, Helvetica, sans-serif">E-Mail:</font></strong></font></p></td> <td><font face="Arial, Helvetica, sans-serif"> <input name="email" type="text" id="email" size="40" maxlength="40"> </font></td> </tr> <tr> <td align="right" valign="middle"><div align="right"><font size="2"><strong><font face="Arial, Helvetica, sans-serif">Person to add:</font></strong></font></div></td> <td><input name="person" type="text" id="person" value="" size="40"></td> </tr> <tr> <td align="right" valign="top"><div align="right"><font size="2"><strong><font face="Arial, Helvetica, sans-serif">Reason:</font></strong></font></div></td> <td><font face="Arial, Helvetica, sans-serif"> <textarea name="reason" cols="20" rows="4" id="reason" style="width: 287px"></textarea> </font></td> </tr> <tr> <td><font face="Arial, Helvetica, sans-serif"> </font></td> <td><font face="Arial, Helvetica, sans-serif"> <input name="Submit" type="submit" id="Submit" value="Submit"> <input name="Reset" type="reset" id="Reset" value="Reset"> </font></td> </tr> </table> </form> </div> </body> </html> when the user clicks submit it references requester.php for its instructions on what to do. That is this code: <? $name = $_POST["name"]; $email = $_POST["email"]; $person = $_POST["person"]; $reason = $_POST["reason"]; $today = date("d, M Y"); $recipient = "millercj@etown.edu"; $subject = "Prayer Request"; $forminfo ="From: $name\nEmail: $email\nForm Submitted: $today\nPerson to add: $person\nReason: $reason\n\n"; $sent = mail($recipient, $subject, $forminfo, "From: $email"); if($sent) { header("Location:http://www.stjohnsuccjonestown.org/portal/requestsuccess.php");} else { header("Location:http://www.stjohnsuccjonestown.org/portal/requestno.php"); } ?> if you look at the last directive it supposed to send the user to requestsuccess.php if it succeeds. It is succeeding because the emails are sending but instead of sending the user to the page it's just displaying a blank white screen (which i believe is requester.php) something isn't allowing it to redirect the user. I hope that makes it clearer Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358621 Share on other sites More sharing options...
LiamProductions Posted September 30, 2007 Share Posted September 30, 2007 Does it work now? {The code i sent above your post} Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358624 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 no, i still get the same thing...blank white screen Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358625 Share on other sites More sharing options...
LiamProductions Posted September 30, 2007 Share Posted September 30, 2007 Whats on requestsuccess.php? Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358628 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 and for shocker-z using your code it says "success" Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358631 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 this is requestsuccess.php <?php /* Is User Logged In? */ session_start(); // this is just your every day page where you would want someone logged in to view the info if ($_SESSION['loggedin'] == TRUE) { // user is logged in print ''; } elseif ($_SESSON['loggedin'] == FALSE) { // user is not logged in header("location:no.php"); // Use is not logged in. Send to notloggedinpage.php exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> .style1 { font-family: Verdana; font-size: small; text-align: center; } </style> </head> <body style="background-image: url('images/bkg.jpg')"> <div style="position: absolute; width: 403px; height: 208px; z-index: 1; left: 18px; top: 9px" id="layer1" class="style1"> <br> <br> <strong>Your request has been submitted successfully! <br> </strong> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358633 Share on other sites More sharing options...
shocker-z Posted September 30, 2007 Share Posted September 30, 2007 remove <?php /* Is User Logged In? */ session_start(); // this is just your every day page where you would want someone logged in to view the info if ($_SESSION['loggedin'] == TRUE) { // user is logged in print ''; } elseif ($_SESSON['loggedin'] == FALSE) { // user is not logged in header("location:no.php"); // Use is not logged in. Send to notloggedinpage.php exit; } ?> and see what you get then mate.. if you get the success page then your looking at an issue with the code u removed Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358646 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 that didn't fix it either Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358660 Share on other sites More sharing options...
shocker-z Posted September 30, 2007 Share Posted September 30, 2007 what about if you log in then just type the address into your addressbar? http://www.stjohnsuccjonestown.org/portal/requestsuccess.php as when i goto that i get "Your request has been submitted successfully!" but before when you had the code in place i got a load of fd;lgadfm'lgdlk;fgn;lsn kind of thing (not a quote) Could be your browser cache.. Liam Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358663 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 right, the jumbled letters was simply my not yet in place access denied page Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358665 Share on other sites More sharing options...
shocker-z Posted September 30, 2007 Share Posted September 30, 2007 yeah i thought so.. kinda thing i do too lol can u now see the success page? or still blank? Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358666 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 i can see it if i navigate too it but not through the form success (which has been the case all along). That still shows me a white screen. I removed both header(Location:) clauses and replaced them with a print'yes'; and print'no'; and that worked. It's definatly something with my head(Location:) but i dont see it where Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358670 Share on other sites More sharing options...
shocker-z Posted September 30, 2007 Share Posted September 30, 2007 create a page with just this in it <?php header("Location:http://www.stjohnsuccjonestown.org/portal/requestsuccess.php"); ?> Does that work? Have you got public details i couyld try your page with? if so make sure you put the header locations back in before i test. Liam Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358672 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 yes that script did work. what do you mean by public details. If you'd like i can give you a login so you can test it...there's really no information in our secure area yet Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358678 Share on other sites More sharing options...
shocker-z Posted September 30, 2007 Share Posted September 30, 2007 yeah please Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358682 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 ok the username is shocker and password is 1234 login here: http://www.stjohnsuccjonestown.org/portal/login.php ignore the annoying background the window launches at 600x350 once it logs you in click prayer chain and then the "add a name button to reach the form" Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358688 Share on other sites More sharing options...
shocker-z Posted September 30, 2007 Share Posted September 30, 2007 hjmmm very weird i get a blank page also.. one thing i can see you missing is session_start(); from the top of your page that sends the email. try this as this works for me <? $name = $_POST["name"]; $email = $_POST["email"]; $person = $_POST["person"]; $reason = $_POST["reason"]; $today = date("d, M Y"); $recipient = "millercj@etown.edu"; $subject = "Prayer Request"; $forminfo ="From: $name\nEmail: $email\nForm Submitted: $today\nPerson to add: $person\nReason: $reason\n\n"; $sent = false; if($sent) { header("Location:http://www.stjohnsuccjonestown.org/portal/requestsuccess.php");} else { header("Location:http://www.stjohnsuccjonestown.org/portal/requestno.php"); } ?> just incase it's an issue with you mail() Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358689 Share on other sites More sharing options...
cfgcjm Posted September 30, 2007 Author Share Posted September 30, 2007 that code gives the same result what & where do you mean i'm missing session start? Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358695 Share on other sites More sharing options...
shocker-z Posted September 30, 2007 Share Posted September 30, 2007 seems like there is some issue on your server then preventing you from sending the header location.. <? session_start(); $name = $_POST["name"]; $email = $_POST["email"]; $person = $_POST["person"]; $reason = $_POST["reason"]; $today = date("d, M Y"); $recipient = "millercj@etown.edu"; $subject = "Prayer Request"; $forminfo ="From: $name\nEmail: $email\nForm Submitted: $today\nPerson to add: $person\nReason: $reason\n\n"; $sent = mail($recipient, $subject, $forminfo, "From: $email"); if($sent) { header("Location:http://www.stjohnsuccjonestown.org/portal/requestsuccess.php");} else { header("Location:http://www.stjohnsuccjonestown.org/portal/requestno.php"); } ?> if your not having start_session(); at the top as above then your session will end and all $_SESSION variables will be lost. Liam Quote Link to comment https://forums.phpfreaks.com/topic/71285-form-emailer-will-not-reach-success-page/#findComment-358699 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.