Im new to php and i have a question with setting cookies, right now i have: <? if($_POST["uname"]=="" & $_POST["uname"]==""){ } else{ if($_POST["uname"]=="$username" & $_POST["uname"]=="$password"){ echo'Login is successful!'; $username = $_POST['uname']; setcookie("phpli", $username, time()+3200); } else{ echo'Username and/or Password is incorrect!'; } } ?> Code (markup): but i get this error when putting in the correct username/password:
Put the "echo" line after the "setcookie" line. I won't get into the PHP code itself (heh), but that should fix the error for you.
still shows that error, but above 'Login is succesful!' heres the code above it: <html> <head> <title>test</title> </head> <body> <? include('../config.php'); ?> <center> <table width="375" border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#000000"> <tr><td align="middle" bgcolor="#589f32"> <b>Login to the administrator panel!</b><br> </td></tr><tr><td> Code (markup):
I got it now, read the php manual and i was suppose to put the code before the <html> and <head> tags.