When I click y link,it is going to x.Why is that ?
<a href="test.php?hello=x">x</a>
<a href="test.php?hello=y">y</a>
<?php
if(isset($_REQUEST['hello']) == 'x')
{
echo 'x';
}
else if(isset($_REQUEST['hello']) == 'y'){
echo 'y';
}
else
{
echo "else";
}
The isset function returns either
trueorfalseand you are comparing that return value with strings'x'and'y'.Since you are using
==and not===,true == 'x'will returnture.To fix this first you need to check if the variable is set and only then compare it.