Results 1 to 2 of 2

Thread: Pass variable from one page to another

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    78

    Pass variable from one page to another

    How can I get the value of a variable from the previous page to the current page?

    I'm currently creating a login system in PHP. I have 3 files; login.php, checklogin.php, and main.php.
    Flow: login.php --- checklogin.php --- main.php

    I have a variable inside checklogin.php named as $id.
    I assigned value to it:
    $id=$_POST['id_number']; //id_number is the name of the textfield in login.php

    Now, I want to assign the value of $id from checklogin.php to variable $id_num from main.php and print the value.
    To become a PROFESSIONAL,
    Start from SCRATCH...

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Pass variable from one page to another

    use sessions or cookies to store the value in checklogin.php once you have cleared the user as being able to login.

    then, in main.php you can just check if the session or cookie exists and is valid. if not, redirect to login page or something of that sort.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width