You'd be better off using empty() within your condition, and an isset() check when declaring $referer .. otherwise you'll generate a PHP notice if $_REQUEST['r'] isn't set...
PHP Code:
if (isset($_REQUEST['r'])) { $referer = urlencode($_REQUEST['r']); }
// then..
if (!empty($referer)) echo '?r=' . $referer;
Edit: Sorry mgraphic didn't realise you'd included those in your example, thought you'd just corrected the logic. Though I don't think you realise empty() implicitly performs an isset() check when called, a combination of the two isn't necessary.
Last edited by adam89; 04-01-2010 at 06:47 AM..
|