user2979226
user2979226

Reputation: 41

passing session variables through header

How can I pass two session variables to loan_officer1.php in below code

    function redirect_to($location = NULL){
        if($location != NULL){
        header("Location:{$location}");
        exit;
        }
    }

    if(mysql_query($query,$connection)){
        //sucess
        redirect_to('loan_officer1.php');
        }else{
        confirm_query($query);
        }

Upvotes: 1

Views: 2596

Answers (3)

user2925077
user2925077

Reputation:

When you use sessions in php then you don't need to pass session variables explicitly.

You can declare session variables suppose on your index page as

<?php
  session_start();
  $_Session['loan_officer_name'] = 'ABC DEF';
  $_Session['loan_officer_post'] = 'Officer';
?>

and then just call your session variables wherever on any page you need to call like

<?php
  session_start();
  echo $_Session['loan_officer_name'];
?>

Remember to call session_start(); on page you want to access session variables.

Upvotes: 1

saloni
saloni

Reputation: 121

Just give the value to $_SESSION For ex,like $_SESSION['location']

Upvotes: 0

Let me see
Let me see

Reputation: 5094

You do not need to pass the..just use this in your loan_officer1.php $_SESSION['name'] and it will give you the value stored in it

Upvotes: 0

Related Questions