BertUK Posted July 5, 2007 Share Posted July 5, 2007 Hi, I've coded quite a lot of php before (last year), but this is so simple there must be something wrong. I have recently created a new website, scripting is enabled, and I've uploaded a file called test2.php, contents as follows :- <?php if(isset($p)) { echo("Hello"); } ?> If I visit http//www.<mysite>.com/test2.php?p=1, I get nothing! Just a blank page. If I modify the code to remove the 'if' statement (i.e just an echo, that works fine). What the hell could be wrong!!? Am I being stupid? Any help appreciated. Thanks, Rob Quote Link to comment Share on other sites More sharing options...
Leppy Posted July 5, 2007 Share Posted July 5, 2007 Sounds like you do not have register global on, try to use $_REQUEST['p'] or $_GET['p']. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 5, 2007 Share Posted July 5, 2007 To read parameters from the URL you'd need to insert this: $p=$_GET['p']; Insert that just before isset() Not stupidity - I've been programming PHP regularly for about 3.5 years and you want to see some of the most crazy and rediculous mistakes I still make Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 5, 2007 Share Posted July 5, 2007 Just for information: $_GET is for reading parameters off the URL. Data from forms using "get" as the method append the data to the URL. $_POST is for reading data packets from forms using method "post" $_REQUEST uses both the above methods and additionally is also for reading from cookies Quote Link to comment Share on other sites More sharing options...
BertUK Posted July 5, 2007 Author Share Posted July 5, 2007 aaah! "register_globals"! Now I remember! The website I created last year had register_globals on but this one obviously doesn't Thanks for the fast response guys 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.