<?php
$error = 'error';
$check = $_SERVER['REQUEST_URI'];
if($check == "/bleachers.php")
{
echo 'bleachers';
}
elseif($check == 'runners.php')
{
echo 'runners';
}
else
{
echo $error;
}
?>
I’m trying to figure out why this is not working. I am trying to echo out a text based on the url of a website. If the url is site.com/bleachers.php echo bleachers
elseif site.com/runners.php echo runners else echo error.
I type in the url site.com/bleachers and error prints out instead.
Start with changing:
into:
this should help you determine what should actually be in the if statements.