-2

I have implemented a simple signup page,which after the user has signed up must re-direct them to the thank you page, here is my code and it returns a blank page

' save.php '

   if($mail->Send()) {}

    unset($_SESSION['GENRE_REQUEST']);

    }
    header('Location:thanku.php');
        exit();
    }
    else
        {
        header('Location:thanku.php');
        exit();
        } '

thanku.php

 <tr>
       <td align="center" valign="top"><b>Thank You for Registering With us.</b> <br />
        <br />please activate your profile by clicking on the activation link sent to your email address.<br/>
       </td>
  </tr> 'a
                      '
FirmView
  • 3,130
  • 8
  • 34
  • 50
Daniel
  • 9
  • 2
  • 3
    Turn on error reporting. And tell the error. – itachi Sep 12 '12 at 13:03
  • Two things: Make sure your `save.php` program is executing the line that your redirect takes place on by placing a `die('test')` just before the `header()` call. Then, make sure your `thanku.php` page is getting called by clearing it of all contents and putting `test` text in it. That way, you will know where the error is occurring. – user1477388 Sep 12 '12 at 13:04
  • 1
    according to the post you posted you got a `}` to much in the first line remove the last one – Breezer Sep 12 '12 at 13:04
  • 1
    if I ever saw a page named "thanku", I would probably leave immediately. – wesside Sep 12 '12 at 13:04
  • sorry, what is this? } ' is it a typo? – FirmView Sep 12 '12 at 13:10
  • possible duplicate of [PHP Header redirect not working](http://stackoverflow.com/questions/423860/php-header-redirect-not-working) – T.Todua Jul 24 '14 at 08:29

3 Answers3

1

Try,

if($mail->Send()) {
    header('Location:thanku.php');
    exit();
}else{
    echo "Oops! there was some error in sending the mail";
}

In thanku.php page,

<?php
    session_start();
    session_unset();
    session_destroy();
    $_SESSION = array();

    echo "Thanks message";

?>
FirmView
  • 3,130
  • 8
  • 34
  • 50
0

It would be helpful to see more of your code. Also, if your header("Location:somenewpage.php") call is failing, php should be emitting some sort of error. Do you have display_errors turned on in your php settings (at least for your dev environment)? That will help you get a sense for what is going wrong with your script.

Jason Fingar
  • 3,358
  • 1
  • 21
  • 27
0

try it like this

if($mail->Send()) {
   session_destroy();
   header('Location:thanku.php');
}
else
{
  header('Location:thanku.php');
}
AboQutiesh
  • 1,696
  • 2
  • 9
  • 14