Ok, I have searched and found many related issues on this site but for the life of me I can not figure out what I am doing wrong here.
I am converting a localstroage value to a PHP variable using the following...
$foo = "<script>document.write(localStorage.getItem('bar'));</script>";
So far so Good. Then I check it by echoing the PHP Variable like this...
echo $foo;
And this works fine. It outputs the saved number that is in that storage value.
99
But the next step is where it goes wrong... I am trying to check the number ($foo) to see if it equals a certain number (in this case "99", which it does) by using the IF PHP statement while also checking files in a specific folder....
if ($foo == '99') {
if ($handle = opendir('./folder/')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
include './folder/' . $entry . '';
}
}
closedir($handle);
}}
But even though the output and stored item is "99", it yields no results as if it is another number altogether.
And I know that the rest of the code works fine because I have tested that without the IF statement.
I suspect it may be something simple that I am overlooking. It often is. I lost my Easy Button.
Aucun commentaire:
Enregistrer un commentaire