...

View Full Version : alert problem



tanhaha_how
01-15-2007, 10:28 AM
hi everyone,i hav a problem regarding the alert msg box will popup twice with the same msg....


<?php
include 'connStr.php';

session_start();

$query = "Select count(*) from tbldentist WHERE Login_ID='".$_POST["txtlogin"]."' and Password='".$_POST["txtpassword"]."'";

$result = mysql_query($query);
$row = mysql_fetch_row($result);

if ($row[0] == 1){
session_register("txtlogin");
session_register("txtpassword");
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";
echo "<meta http-equiv=\"REFRESH\" content=\"0; URL=adminHome(frameset).php\">";

}else{
session_unset();
session_destroy();
echo "<script type=\"text/javascript\">alert(\"Invalid Password!!\")</script>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";
echo "<meta http-equiv=\"REFRESH\" content=\"0; URL=login.php\">";
}
//}
?>

the red color above....will popup 2 times....means when i key in wrong password,the alert msg will popup.after i click OK,the alert msg box will popup again....

thank u

chump2877
01-15-2007, 11:30 AM
I assume what's happening is that you are redirecting to the same page of code after the first alert box displays. The code executes again, finds the "else" condition to be true (again) and displays the alert box again....and again and again and again....



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum