tmyonline Posted May 6, 2008 Share Posted May 6, 2008 Guys: I'm having this problem that bugs me. Here's a snippet of my code: $contactID = $_GET['id']; echo 'contactID = ' . $contactID; if (isset($_POST['send'])) { echo 'contactID = ' . $contactID; // nothing appeared, wonder why ? ! } The problem is that, somehow, my "$contactID" variable lost its value inside the if statement. It didn't help when I used $_SESSION['contactID'] = $_GET['id'] either. Any ideas ? Thanks. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted May 6, 2008 Share Posted May 6, 2008 What's the actual output from the above? Do you mean that nothing from this line: echo 'contactID = ' . $contactID; // nothing appeared, wonder why ? ! is displayed? In which case, the if statement is evaluating to false. You appear to be using get and post. Perhaps that is the problem? Quote Link to comment Share on other sites More sharing options...
tmyonline Posted May 6, 2008 Author Share Posted May 6, 2008 The actual output is: contactID = So, contactID lost its value. The if statement did evaluate to true because other things (not shown) inside the if statement were processed as expected. As for the potential complication due to using post & get, I just switched everything to "get" but it didn't help. I used $_GET['id'] to get the id value from the url. I'm not sure how that can conflict with the method specified in my form. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted May 6, 2008 Share Posted May 6, 2008 If you have a session variable by the same name, it is highly likely that register globals are on and the various variables with the same name are overwriting each other. If not, then you really need to post your actual code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.