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..

Recommended Answers

All 2 Replies

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)
...

thank you bro.
its working fine you rock :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.