I have a page that will show multiple content, depending on what ID the user has in their URL.
e.g:-
If they have accessed https://stackoverflow.com/#cars - I want to show cars only.
If they have accessed https://stackoverflow.com/#trains - I want to show trains only.
I would like to do this in PHP, as I do not want the other information displayed.
I have tried the following, but with no luck:-
<?php
$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if (strpos($url,'cars') !== false) {
echo 'Car exists.';
} else {
echo 'No cars.';
}
?>
Can anyone please help?