Jump to content

[SOLVED] Very simple php query - I'm tearing my hair out!


BertUK

Recommended Posts

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

 

Link to comment
Share on other sites

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 :D

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.