hello friends, i'm newbie in PHP. I don't what is the problem of my code below. This program still get error when sending session variabel to succes.php
here is error message:
"Warning: Cannot add header information - headers already sent by....etc". Is there any idea how to solve this. Thanks anyway for helping me.
here is my problem code:
<form method="POST" action="<?php echo($PHP_SELF); ?>">
<table>
<tr>
<td>Username</td>
<td><input type="text" name="username">
</td>
</tr>
<tr>
<td width="29%">Password</td>
<td><input type="text" name="password"></td>
</tr>
</table>
<br>
<input type="submit" name="Add" value="Submit">
</form>
<?php
if ($Add == "Submit") {
session_start();
if (@$username && @$password) {
$scores = mysql_pconnect("localhost", "user", "pass");
$db = mysql_select_db("tesdb");
$res = @("SELECT * FROM login WHERE username='$username' AND password='$password'");
if(@mysql_num_rows($res) != 0) {
session_register("verified_user");
$verified_user = $username;
Header("Location : succes.php");
} else {
echo "invalid user/pass";
}
}
}
?>