Hi All,
I have a script that relies on a numeric variable from GET. I am trying to figure out how to have a 'default' value if no GET value is passed in the url.
I have been trying to get it to work with if() but no joy:
$par2 = $_GET['par1'];
if(empty($par2))
{ $par = 4;
} $par = $par2;
So if a value for 'par1' is passed in the url then $par will be whatever that value is. However if no value is passed then the default value for $par should be 4. Unfortunately that code doesn't seem to work. If i pass no 'par1' value in the url i jest get a php error. Any tips on where im going wrong here would be much appreciated.
Thanks in advance for any help,
Matt