Results 1 to 8 of 8

Thread: how to post something to a session

  1. #1
    Join Date
    Jan 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question how to post something to a session

    Hi,

    How would I, instead of submitting something to the $_POST array, make it go into the $_SESSION array?

  2. #2
    Join Date
    Jan 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Yeah, also what should I use if I want to include stuff in my PHP files? .inc or what?

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    How would I, instead of submitting something to the $_POST array, make it go into the $_SESSION array?
    You wouldn't. POST it to a page, and then from there put it into a session.
    Yeah, also what should I use if I want to include stuff in my PHP files? .inc or what?
    The file extension doesn't matter. It's common to use something like .php or .inc.php (or to cause PHP to parse .inc files) to avoid people viewing the source of the include, which may contain sensitive information. However, it's really not important.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jan 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking

    Ok, how would I put a variable into the session?

  5. #5
    Join Date
    Jan 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    By the way, thank you sooooo much!

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Read http://www.php.net/session for more information on handling sessions.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    $_SESSION['varname'] = $_POST['varname'];

    Or, if you really wanted....
    $_SESSION = $_POST;

    But I think that would screw things up, including confusing the session id.
    I think there's a merge Array function available. Check php.net for it.

    And check the link Twey gave... should help.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Jan 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking

    Thank you so much everybody for your time and help!!!!!!!!!!!!

Bookmarks

Posting Permissions

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