I got a little problem. When I got my PHP script without header it\'s fine, I am getting javascript alert box. But when I use header before alert it\'s not working. It\'s re
Use $_SERVER 'php_self'. It will allow you to create script on same page where you want alert. In this way you won't have to add header.
Here's an example:
$sqluname="root";
$sqlpword="hrhk";
$database="registration";
$server="127.0.0.1";
$db_handle=mysql_connect($server,$sqluname,$sqlpword,$database);
$db_found = mysql_select_db($database, $db_handle);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$uname = $_POST["username"];
$pword = $_POST["password"];
$ulength=strlen($uname);
$plength=strlen($pword);
if($ulength > 5){
$sqlquery="SELECT * FROM members WHERE username='$uname' AND password='$pword'";
$result=mysql_query($sqlquery);
$num_rows=mysql_num_rows($result);
if ($num_rows >0) {
echo "";
session_start();
$_SESSION['sid']=$uname;
header("location:Yahoo/yahoo.php");
}
else{
echo "";
}
}
else{
echo"";
}
}
?>