Log in

View Full Version : Parse error: syntax error



dcr33
01-01-2012, 06:44 AM
<?php
session_start();
unset($_SESSION['uname']);
unset($_SESSION['utype']);
header('location:signin.html');
?>
I am getting the following error when I run above code-
"Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ')' in D:\xampp\htdocs\...\signout.php on line 3"
Pls Help

djr33
01-01-2012, 08:17 AM
I don't see anything wrong. Retype the above code to be sure that it doesn't contain any invisible characters (perhaps from cutting and pasting).

If not, it's only 4 lines, so you should be able to figure out what's going on by commenting each line out individually-- //line. You might want to disable (comment out) the redirect while you're testing.

traq
01-01-2012, 09:10 AM
not directly related, but
header('location:signin.html');needs to be
header('Location: http://example.com/path/to/signin.html');
note the spacing, capitalization, and absolute URI (relative URIs don't work reliably in all browsers; see note #6 (http://php.net/manual/en/function.header.php#refsect1-function.header-notes)).

dcr33
01-01-2012, 01:05 PM
Sorry,this question was wrongly posted.

Actually I was modifying another program & running this program!!! :p
lol :o

p.s. :@Moderator -Why is there no option of deleting a question wrongly posted?
:rolleyes: :eek: