0

Hello,
i got a problem with $_GET[]. please see the below code and help me.

<?php
if(isset($_GET['_rp'])==1)
{
echo '1';
}
else if(isset($_GET['_rp'])==1)
{
echo '2';
}
?>

when i'm changing the value of _rp=2 it was showing the result as '1' but not '2'. Why this was happening please help me to solve..

2
Contributors
2
Replies
14
Views
4 Years
Discussion Span
Last Post by anil14353
1

The isset() function returns TRUE or FALSE. You probably wanted it this way:

if(isset($_GET['_rp']) && $_GET['_rp'] == 1)
...
elseif(isset($_GET['_rp']) && $_GET['_rp'] == 2)
...

Edited by broj1

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.