I need to extruct the last letter after '?p='
in a URL with GET
?
Example: http://www.example.com/test.php?p=1
How can I get only those numbers 1
I think this is the right methode to get my URL and put it in a variable:
$numbers = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
If so, how can I get only those numbers in order to put them in a variable?
It seems like an obvious questions but the $_GET["p"] doesn't work??
Here is the code.
if(isset($_GET["p"]))
{
//var_dump($_GET["p"]); // This var_dump displays the correct number 1 which is correct but when I put it in a variable and use that variable I get an error that says "Notice: Trying to get property of non-object in C:\wamp\www\Store_Locator\test2.php on line 21".
$myVariable = $_GET["p"]; // When I write $myVariable = 1; it works!
echo '<p><strong>ID:</strong> '.$xml->ROW[$myVariable]->FIELD1.'</p>'; // This is line 21
}
By the way, I am trying to display data from an XML file.
Best Regards,