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 9 of 9
  1. #1
    CPD
    CPD is offline
    New Coder
    Join Date
    Jul 2012
    Location
    Ontario Canada
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Loosing $_Session and $_GET data in the middle of a form

    Hello all

    I have a script that sends $_GET data via url that I need to keep, but I loose it when going through a 6 level dependent drop down.
    PHP Code:
    <?
    session_start
    ();
    // store session data
    $_SESSION['client_id']= $_GET['id'];
    ?>
    This $_GET['id'] comes from the previous page via url, but I loose it during an auto submit, all the $_GET variables unset and I need to keep them for further processing
    even trying to store it in the $_SESSION['client_id'] as seen above, gets unset
    PHP Code:
    <?
        
    if($region != null && $lastname != null && $firstname != null && $phone != null && $cust != null)
        {   
    ?>
        <select name="vid" onChange="autoSubmit();">        
            <option value="null">Select Venue</option> 
    <?
            
           
            
            $sql1 
    "SELECT vid, vname FROM venue WHERE re_id = $region";
            
    $venues mysql_query($sql1,$conn);
      
            while(
    $row mysql_fetch_array($venues))

            {      
            echo (
    "<option value=\"{$row['vid']}\" " . ($vid == $row['vid'] || $_GET ["vnm0"] == $row['vname']? " selected" "") . ">{$row['vname']}</option>");    
            }    
    ?>   
        </select>
    <?
        
    }                
    ?>
    How can I store Variables that will stay set until I call an unset on them regardless of how many submits or auto submits the script uses
    Thanks
    Last edited by CPD; 07-28-2012 at 12:17 AM.

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Well, a GET is part of a page URL, so if you submit a form and it moves to another page, you'll lose the GET unless you put it back into the URL. That' being said, you're storing it into a session already... why not just call the session?

  • #3
    CPD
    CPD is offline
    New Coder
    Join Date
    Jul 2012
    Location
    Ontario Canada
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I do try to recall the session but everything returns NULL

    after an auto submit I get this



    [_SESSION] => Array
    (
    [client_id] => <------this I need and it disappears after an auto submit
    )
    Last edited by CPD; 07-26-2012 at 10:48 PM.

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Did you remember to call session_start() again in your next script?

    session_start() doesn't just start a session, it also resumes the session and must be used in every php file that uses the session.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • Users who have thanked tangoforce for this post:

    CPD (07-27-2012)

  • #5
    CPD
    CPD is offline
    New Coder
    Join Date
    Jul 2012
    Location
    Ontario Canada
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks so much "tangoforce", the SESSION was not called and therefore SESSION was not transferred to next page, once again THANKS

  • #6
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Glad to be of service
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #7
    CPD
    CPD is offline
    New Coder
    Join Date
    Jul 2012
    Location
    Ontario Canada
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts
    How do I declare this thread solved ??

  • #8
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Edit your original post at the top and select resolved by the subject.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #9
    CPD
    CPD is offline
    New Coder
    Join Date
    Jul 2012
    Location
    Ontario Canada
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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
    •