-1

When I run this page, it shows an error:

if (isset($_POST['send'])) {
    mysql_connect("localhost", "MY_DB", "MY_PASSWORD") or die(mysql_error());
    mysql_select_db("") or die(mysql_error());

    $username = $_POST['username'];
    $password = $_POST['password'];

    $result = mysql_query("SELECT * FROM manager WHERE username='$username'") or die(mysql_error());
    $row = mysql_fetch_array($result);
    if ($password == $row['password']) {
        $_SESSION['confirm'] = '1';
        header("Location: view.php");
    } else {
        echo"Not User";
    }
}

It should echo the data of a MySQL table. It logs in correctly, but it does not redirect to view.php. The error is:

Warning: Cannot modify header information - headers already sent by (output started at /home/mftporta/public_html/tooga/login.php:5) in /home/mftporta/public_html/tooga/login.php on line 21

hopper
  • 13,060
  • 7
  • 49
  • 53
sepehr2121
  • 87
  • 8

1 Answers1

1

this error can be, an output (print, echo, message error, white space, BOM character) before redirect(header())

how remove BOM character

Community
  • 1
  • 1
rray
  • 2,518
  • 1
  • 28
  • 38