Jump to content

header error


m118

Recommended Posts

I create a  login form , but I do not work well. The web can not redirect to the other page. I get error message .

 

 

  Cannot modify header information - headers already sent by (output started at D:\AppServ\www\mission1\checklogin.php:10) in D:\AppServ\www\mission1\checklogin.php on line 30

 

 

Please tell me how to modify the code . Thank you very  much.

 

  • <?php
  • include("connect.php");
  • $myusername=$_POST['myusername'];
  • $mypassword=$_POST['mypassword'];
  • $tbl_name="members";
  • $chun="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
  • $result1=mysql_query($chun);
  • // Mysql_num_row is counting table row
  • $count=mysql_num_rows($result1);
  • echo "$count";
  • // If result matched $myusername and $mypassword, table row must be 1 row
  • if($count==1){
  • // Register $myusername, $mypassword and redirect to file "login_success.php"
  •   $_SESSION["myusername"]=$myusername;
  •   $_SESSION["mypassword"]=$mypassword;
  • header("location:6.php");
  • }
  • else {
  • echo "Wrong Username or Password";
  • }
  • ?>

 

Link to comment
https://forums.phpfreaks.com/topic/241132-header-error/
Share on other sites

Read the error message. It tells you where the output is occurring at in your code that is causing the problem - output started at D:\AppServ\www\mission1\checklogin.php:10 (line 10.)

 

Then look at line 10 in your code and try to determine what your code is doing on line 10 that could be sending output to the browser and eliminate that output.

Link to comment
https://forums.phpfreaks.com/topic/241132-header-error/#findComment-1238577
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.