Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: alert problem

  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question alert problem

    hi everyone,i hav a problem regarding the alert msg box will popup twice with the same msg....
    Code:
    <?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

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    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....
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •