I have the if/elseif/else statement as stated below and the idea is if I load the browser with domain.com/listing/email/12, I would execute the email function, if I load domain.com/listing/mortgage/12, mortageCalc() would be executed, etc.

The problem is no matter which page I load, whether it's the email link (domain.com/listing/email/12), mortage link (domain.com/listing/mortgage/12) or visit link (domain.com/listing/visit/12), only the email function loads. I can't get the mortgage function to load when I go to domain.com/listing/mortgage/12 or the scheduleVisit function to load when I go to domain.com/listing/visit/12.

Any help is appreciated.


here is the php file
PHP Code:
if(isset($_GET['listingPage'])=='email'){
    
email();
}
elseif(isset(
$_GET['listingPage'])=='mortgage'){
    
mortgageCalc();
}
elseif(isset(
$_GET['listingPage'])=='visit'){
    
scheduleVisit();
}
else{
    
main();

here is my .htaccess file:
PHP Code:
RewriteRule ^listing/email/([a-zA-Z0-9_-]+)$ /ctrl.php?throw=public/detail.php&lid=$1&listingPage=email
RewriteRule 
^listing/mortgage/([a-zA-Z0-9_-]+)$ /ctrl.php?throw=public/detail.php&lid=$1&listingPage=mortgage
RewriteRule 
^listing/visit/([a-zA-Z0-9_-]+)$ /ctrl.php?throw=public/detail.php&lid=$1&listingPage=visit