...

View Full Version : Resolved Loosing $_Session and $_GET data in the middle of a form



CPD
07-26-2012, 10:34 PM
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.


<?
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


<?
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

Keleth
07-26-2012, 10:38 PM
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?

CPD
07-26-2012, 10:42 PM
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
)

tangoforce
07-26-2012, 10:47 PM
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.

CPD
07-27-2012, 10:39 PM
Thanks so much "tangoforce", the SESSION was not called and therefore SESSION was not transferred to next page, once again THANKS

tangoforce
07-27-2012, 10:56 PM
Glad to be of service :thumbsup:

CPD
07-27-2012, 11:04 PM
How do I declare this thread solved ??

tangoforce
07-27-2012, 11:33 PM
Edit your original post at the top and select resolved by the subject.

CPD
07-28-2012, 12:15 AM
Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum