Firstly I'm new to PHP and have only moved from ASP in the last week.
I am coding a site in PHP for a client and have no understanding of PHP querystrings. I wish to create a referral incentative for customers, in order for the system to pick up referrers I use a querystring eg. http://domain.com/default.php?ref=123456
I have tried using:
<?php $_GET['ref']; ?>
<?php $_GET['ref']; echo $ref;?>
which works fine when there is a querystring present. However without a query in returns an "Undefined index" error.
I need either a quick fix to force a default referrer code ie 123456 when no querystring is present (eg http://domain.com/
). Or a need new way of thinking around this.
Any examples are welcome.