Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts

    Setting a session to hold a value

    I forgot how to put a value into a session to hold over multiple pages.

    Like you are editing user ID 104. So 104 needs to be the value in the session so I can query the ID and update as needed. It was something like this?

    PHP Code:
    $keepid SESSION['id']; 
    Last edited by masterofollies; 03-07-2009 at 11:43 PM.

  • #2
    Regular Coder kokjj87's Avatar
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    279
    Thanks
    1
    Thanked 55 Times in 54 Posts
    PHP Code:
    session_start();
    $_SESSION['id'] = $keepid

  • Users who have thanked kokjj87 for this post:

    masterofollies (03-07-2009)

  • #3
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    Thats for a form?

    Like:
    PHP Code:
    <input type="text" name="myname" value=""
    and after the isset. Do this?

    PHP Code:
    $keepname $_POST['myname'];
    $_SESSION['myname'] = $keepname
    So then I can pull the session like this?

    PHP Code:
    echo "My name is ".$_session['myname'].""

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Yes if you have session_start(); at the top of your code.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    Ok thanks


  •  

    Posting Permissions

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