Jump to content

Form Emailer will not reach success page


cfgcjm
 Share

Recommended Posts

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");
}
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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()

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.