SESSION forms

Discussion in 'PHP' started by Vizuke, Sep 3, 2006.

  1. #1
    Hi, I'm fairly new to php coding and would like to know how to make a form that process the input data into the $_SESSION headers.

    Currently, I have a form with the post method and upon loading a page, it checks to see if $_POST is set and if it is, I had it to set $_SESSION to that $_POST value. Anyone can tell me if this is secure or there is a more robust way to do it?
     
    Vizuke, Sep 3, 2006 IP
  2. dalziel

    dalziel Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If all you want to do is take $_POST["varname"] and stick it into $_SESSION["varname"] so it's available to the session, that should be fine. If you wanted to store a number of form fields' values & have more flexibilty you could create a class to store the data and serialize that into the session object. But if it's just a couple of values, that's probably overkill

    cheers
    Glenn
     
    dalziel, Sep 4, 2006 IP