I'm running into a strange problem where $_REQUEST
is not showing the value of a parameter I am explicitly passing e.g.
http://example.com/strange.php?parName=1234
strange.php
:
<?php
$foo = $_REQUEST['parName'] ;
echo $foo ;
?>
I have looked in the Inspector and the Network tab actually shows the correct query string parameter.
I have carried out some tests.
in test.html:
<a href="request.php?parName=1234">link</a>
in request.php:
$foo = $_REQUEST['parName'];
echo $foo ;
I have also tried:
$foo = $_GET['parName'];
echo $foo ;
Both of which work.
Therefore thinking about the strange issue you are encountering, you will need carry out various checks:
Check to see if the parName variable isset
if(isset($_GET['parName'] )) {
$foo = $_GET['parName'];
echo $foo ;
}
else { "echo query string not received";
}
What data is actually contained in the parName variable?
var_dump($_REQUEST['parName'])
Once you've run all these tests, and the issue is still not resolved, please post your results so we can consider other possible paths to solving this problem.