Hi, I'm having a notice message come up with the following code: LINE2: $qs = getenv("QUERY_STRING"); LINE3: $split = explode("=", $qs); LINE4: $firstvar = $split[0]; LINE5: $secondvar = $split[1]; Code (markup): The problem is coming from LINE5. The error I get is: Notice: Undefined offset: 1 The problem only occurs when $split[1] doesn't contain any information. I've tried to remove the notice by using an IF ... eg. if ($split[1]) { secondvar = $split[1]; } but it still spat out the same warning. Anyone with a bit more experience help me out? Many thanks! Gary
Not that nice, but I always use it $secondvar = @$split[1]; or, better, but more typing if (isset($split[1])) $secondvar = $split[1]; else $secondvar = null;
Thanks Kwaku! Yes, if this was a script that I am writing just for ME then I would have used the silencer (@) Thank you very much for your help... this bit of code has sorted it right out: if (isset($split[1])) $secondvar = $split[1]; else $secondvar = null; Code (markup): Warmly, Gary