Get Page Name from Web Address using PHP

With PHP you can recognize the page you are on and then display a proper header for that page.

For example:

<?php
// let's say the URL is page.com/form.php
$page_name =  basename($_SERVER['PHP_SELF'],".php");
print $page_name; //form
?>

Tags: