-2

I keep getting this Notice: Undefined variable: previouspage in /var/www/html/ies.aacrao.org/apply/copies.php on line 7 on this line of code:

if ($previouspage == "copies.php") {
    // _s2 variables are the shipping address for the included copy
    $first_s2 = $_SESSION['first_s2'] =  $_POST['first_s2'];
    $last_s2 = $_SESSION['last_s2'] =  $_POST['last_s2'];
    $email_s2 = $_SESSION['email_s2'] =  $_POST['email_s2'];
    $phone_s2 = $_SESSION['phone_s2'] =  $_POST['phone_s2'];
    $title_s2 = $_SESSION['title_s2'] =  $_POST['title_s2'];
    $office_s2 = $_SESSION['office_s2'] =  $_POST['office_s2']; 
    $institution_s2 = $_SESSION['institution_s2'] =  $_POST['institution_s2'];      
    }

Can anyone give me some pointers on how to fix this issue. All of these variables are supposed to be inserted into a database table and at the moment they are not getting inserted.

1 Answers1

0
if(!empty($previouspage) && $previouspage == "copies.php")

or

if(isset($previouspage) && $previouspage == "copies.php")

I would go with !empty().

By the way, look at these functions.

Empty: http://tr2.php.net/empty

Isset: http://tr2.php.net/isset

Quick explanation:

empty checks for if the variable is defined and has a value, isset just checks if the variable is defined.

Canser Yanbakan
  • 3,780
  • 3
  • 39
  • 65