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"); 
}  

Recommended Answers

All 6 Replies

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

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>

Thank you so much for your help! yey! :)

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>
      "

I hope your problem is solved. If it is, help others know the thread is solved.

SOLVED!!! THANK YOU VERY MUCH!!! ARIGATOU GOZAIMASU!!! GRACIAS!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.