Missing a closing ) on this line:
if( strstr(!$_SERVER['HTTP_REFER'],$mydomain)
Echo will do fine if you're just printing the values so it's viewable from the browser.
And this:
echo ('" . $_SERVER['HTTP_REFERER'] . "','" . $_SERVER['PHP_SELF'] . "')";
should be:
echo "'".$_SERVER['HTTP_REFERER']."','".$_SERVER['PHP_SELF']."'";
That will output:
'the_referrer','the_php_script'
where "the_referrer" and "the_php_script" are replaced by their respective variables.
~Brett