FirePhoenix Posted February 22, 2007 Share Posted February 22, 2007 I am trying to make a simple password program and when you hit the submit button it gives me this error: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/www/myserver.com/index.php:3) in /home/www/myserver.com/index.php on line 27 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/www/myserver.com/index.php:3) in /home/www/myserver.com/index.php on line 27 Here is my script for index.php (I know its messy) <?php if ($_POST["username"]=="") { ?> <html> <body> <center> Please Login:<BR> <form method="post" action="index.php"> Username: <input type="text" name="username" size="20"><BR> Password: <input type="password" name="password" size="20"><BR> <input type="Submit" value="Submit"> </form> </center> </body> </html> <?php }else{ $username=$_POST["username"]; $password=$_POST["password"]; session_start(); if ($username=="user1" AND $password=="password1"){ $permission="yes";} if ($username=="user2" AND $password=="password2"){ $permission="yes";} $username=$_POST["username"]; session_register("permission"); session_register("username"); if ($permission=="yes"){ ?> <html> <body> <center> Please choose the service you would like to update: <BR> <A HREF="access1.php">Dish Network</A><BR> <A HREF="access2.php">Direct TV</A> </center> </body> </html> <?php }else{ ?> Error in username or password <?php } ?> <?php } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 22, 2007 Share Posted February 22, 2007 There is a stickied topic about this. You can't print HTML before session_start(). Quote Link to comment Share on other sites More sharing options...
FirePhoenix Posted February 22, 2007 Author Share Posted February 22, 2007 Thank you can you tell me where the topic is Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 22, 2007 Share Posted February 22, 2007 Yes, I can. Quote Link to comment Share on other sites More sharing options...
FirePhoenix Posted February 22, 2007 Author Share Posted February 22, 2007 lol will you please Quote Link to comment Share on other sites More sharing options...
FirePhoenix Posted February 22, 2007 Author Share Posted February 22, 2007 I am sorry I am a moron and yes it helped thank you I am new here I havent really explored yet I guess I should thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.