0

Pls. help me with this code :) the alert box is not appearing and it goes directly to homebody_admin.php
I want the homebody_admin.php to appear after I click the ok button on alert box pls help.
Your help is highly appreaciated! thanks in advance :)

if($password!= mysql_result($result, 0))  
{  
    echo ("<SCRIPT LANGUAGE='JavaScript'>
        window.alert('You entered an incorrect password!')
        </SCRIPT>");
    //echo "You entered an incorrect password"; 
    header("Location:homebody_admin.php"); 
}  
4
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by weirdCreature7
1

Try using a semicolon after the window.alert() or additional attributes to the script-tag like type.

Edited by C#Jaap

1

It's not appearing, because you're rendering content on the current page, then immediately redirecting the user to a different page, before they see the content.

<script type="text/javascript">
if(confirm('You entered an incorrect password'))
    window.location = 'homebody_admin.php';
</script>
0

echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('You entered an incorrect password!')
</SCRIPT>");

Try this.

echo( " <script language='JavaScript'>  
             alert('You entered an incorrect password!');
        </script>
      "
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.