03laceys Posted July 18, 2008 Share Posted July 18, 2008 Hello, I have been trying over the past couple of hours to get a popup box to popup when you have a new message. As i have added the code into the header to do this the popup pops up on every page like i wish it to.. The problem is i only want it to pop up when a user has a new mail... I have tried this and a few others.. Add this below global at very top of the page... $mc=$ir['new_mail']; Then add this at the very bottom of the page... if($mc > 0) { print "Pop up box here."; } The box is popping up if there is a new mail or not it dosn't matter. Any help on fixing this would be great. Quote Link to comment Share on other sites More sharing options...
Kasabian Posted July 18, 2008 Share Posted July 18, 2008 Re: Mailbox popup... in header??? try using <div> with your css Quote Link to comment Share on other sites More sharing options...
Joel Posted July 18, 2008 Share Posted July 18, 2008 Re: Mailbox popup... in header??? What you mean, you want it show up somewhere on a page or do you want a box to pop up saying something like "you have 1 new mail" well here's a little script to make a box pop up when you have 1 new mail if ($ir['new_mail'] > 0) { echo '<script> alert("You have 1 new mail!") </script>'; } add it to header.php Quote Link to comment Share on other sites More sharing options...
fbiss Posted July 18, 2008 Share Posted July 18, 2008 Re: Mailbox popup... in header??? In my opinion I think it would be annoying as hell if u didn't want to read your email right away that you got a pop up on every page click. Especially if you are in the middle of attacking somebody. Quote Link to comment Share on other sites More sharing options...
03laceys Posted July 18, 2008 Author Share Posted July 18, 2008 Re: Mailbox popup... in header??? Attacking, is one click attack ;) also i have no mainmenu on my game so it dosn't display mailbox (1) sort of thing. Quote Link to comment Share on other sites More sharing options...
03laceys Posted July 18, 2008 Author Share Posted July 18, 2008 Re: Mailbox popup... in header??? Not working :? I have added it about the </body> tag... I get no error. just nothing. Quote Link to comment Share on other sites More sharing options...
Kasabian Posted July 18, 2008 Share Posted July 18, 2008 Re: Mailbox popup... in header??? have you looked up <div> or just over looked it? somthing along these lines (off the top of my head) css: .message { border: 2px soild #333333; font: 12px Arial; text-indent: 3px; height: 200px; width: 300px; overflow: auto; position: absolute; left: 100px; right: 100px; top: 100px; bottom: 100px; div: if ($ir['new_mail'] > 0) { echo '<script> alert("<div class='message'>stuff here or message</div>") </script>'; } if it dont work ... Use google and google <div> Quote Link to comment Share on other sites More sharing options...
03laceys Posted July 18, 2008 Author Share Posted July 18, 2008 Re: Mailbox popup... in header??? I don't think its to do with div i think the header isn't searching the database for "new_mail" :? Quote Link to comment Share on other sites More sharing options...
Kasabian Posted July 18, 2008 Share Posted July 18, 2008 Re: Mailbox popup... in header??? o sorry.. i was posting the code for the pop up box Quote Link to comment Share on other sites More sharing options...
03laceys Posted July 18, 2008 Author Share Posted July 18, 2008 Re: Mailbox popup... in header??? I have the popup box working just not when a new mail is recived :? Quote Link to comment Share on other sites More sharing options...
Kasabian Posted July 18, 2008 Share Posted July 18, 2008 Re: Mailbox popup... in header??? what you using for the box that would help? Quote Link to comment Share on other sites More sharing options...
03laceys Posted July 18, 2008 Author Share Posted July 18, 2008 Re: Mailbox popup... in header??? Its not anything to do with the box.. It's to do with the if statment. The popup box works fine (from dynamic drive) But will not open when i want it to lol. So its the statment.. must be not calling it properly Quote Link to comment Share on other sites More sharing options...
03laceys Posted July 18, 2008 Author Share Posted July 18, 2008 Re: Mailbox popup... in header??? Ok i have had a play around and have got this far... <?php global $db, $ir; if ($ir['new_mail'] > 0) { echo '<script> alert("You have 1 new mail!") </script>'; } else { } ?> I have named that file mainmenu.php and got the header.php to call it. The pop up box works but pops up even if you dont have a new mail. Any more help? Quote Link to comment Share on other sites More sharing options...
Joel Posted July 19, 2008 Share Posted July 19, 2008 Re: Mailbox popup... in header??? I think you have screwed up one of your files Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.