I am using the following code to show the referer link any page on my website. How can i modify the code so that it only shows part of the link. i.e if my website url is www.example.com/?s=printing i only want it to extract printing. And this should only happen if the format is www.example.com/?s=aaa and not if the format is anything else like www.example.com/printing.
Code:
<?php
session_start();
if ( !isset( $_SESSION["origURL"] ) )
$_SESSION["origURL"] = $_SERVER["HTTP_REFERER"];
echo $_SESSION["origURL"]
?>
I figured it out and the following code works:
Values that are send to a page as part of a link are stored by default in the
$_GET
variable. Your URL is usings=printing
. This means the name of the property iss
and the value of the property isprinting
Instead of all the string search actions you could use