Jump to content
MakeWebGames

Mailbox popup... in header???


03laceys

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...