We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,437 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

A newbie HELP! alert box not working

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
2 Weeks
Discussion Span
9 Months Ago
Last Updated
7
Views
weirdCreature7
Newbie Poster
16 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

C#Jaap
Junior Poster in Training
63 posts since Sep 2009
Reputation Points: 15
Solved Threads: 11
Skill Endorsements: 0

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>
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

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

weirdCreature7
Newbie Poster
16 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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>
      "
rotten69
Master Poster
747 posts since May 2011
Reputation Points: 36
Solved Threads: 47
Skill Endorsements: 11

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

rotten69
Master Poster
747 posts since May 2011
Reputation Points: 36
Solved Threads: 47
Skill Endorsements: 11

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

weirdCreature7
Newbie Poster
16 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.3045 seconds using 2.73MB