473,394 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

pop up messages in php

65
Hi friends,
Can anyone tell me how can I create pop up messages in PHP...??
Is it possible in PHP?
Pop up messages in the sense, it should be triggered during the users entering their input in a form.
Plz.....Show me some sample codes........


Thanx n Regards
Yas
Feb 26 '08 #1
6 1994
odobo
11
-yasmine
php is server-side scripting.. meaning that the code is processed by the server not by the client. You need to use client side code.
just use javascript.
like so:
Expand|Select|Wrap|Line Numbers
  1. <script type="javascript">
  2. function popUp
  3. (URL,Width,Height,Left,Top,Toolbar,Resizeable,ScrollBars,MenuBar,
  4. StatusBar,Resizeable) {
  5. Toolbar = Toolbar==null||Toolbar==""?1:Toolbar;
  6. Resizeable = Resizeable==null||Resizeable==""?1:Resizeable;
  7. ScrollBars = ScrollBars==null||ScrollBars==""?1:ScrollBars;
  8. MenuBar = MenuBar==null||MenuBar==""?1:MenuBar;
  9. StatusBar = StatusBar==null||StatusBar==""?1:StatusBar;
  10. Resizeable = Resizeable==null||Resizeable==""?1:Resizeable;
  11. day = new Date();
  12. id = day.getTime();
  13. eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar="+Toolbar+",scrollbars="+ScrollBars+",location=1,statusbar="+
  14. StatusBar+",menubar="+MenuBar+",resizable="+Resizeable+",width="+
  15. Width+",height="+Height+",left="+Left+",top="+Top+"');");
  16. }
  17. </script>
  18.  
  19. and call it like so on an onclick event on a input box or something:
  20.  
  21. <input id="Pod_ID" onclick="popUp("http://yourwebsite.com/",600,400,200,200,);" type="text" />
-odobo
Enclose your code within the appropriate code tags!! - moderator
Hi friends,
Can anyone tell me how can I create pop up messages in PHP...??
Is it possible in PHP?
Pop up messages in the sense, it should be triggered during the users entering their input in a form.
Plz.....Show me some sample codes........

Thanx n Regards
Yas
Feb 26 '08 #2
yasmine
65
-yasmine
php is server-side scripting.. meaning that the code is processed by the server not by the client. You need to use client side code.
just use javascript.
like so:
<script type="javascript">
function popUp(URL,Width,Height,Left,Top,Toolbar,Resizeable ,ScrollBars,MenuBar,
StatusBar,Resizeable) {
Toolbar = Toolbar==null||Toolbar==""?1:Toolbar;
Resizeable = Resizeable==null||Resizeable==""?1:Resizeable;
ScrollBars = ScrollBars==null||ScrollBars==""?1:ScrollBars;
MenuBar = MenuBar==null||MenuBar==""?1:MenuBar;
StatusBar = StatusBar==null||StatusBar==""?1:StatusBar;
Resizeable = Resizeable==null||Resizeable==""?1:Resizeable;
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar="+Toolbar+",scrollbars="+ScrollBars+",loc ation=1,
statusbar="+StatusBar+",menubar="+MenuBar+",resiza ble="+Resizeable+
",width="+Width+",height="+Height+",left="+Left+", top="+Top+"');");
}
</script>

and call it like so on an onclick event on a input box or something:

<input id="Pod_ID" onclick="popUp("http://yourwebsite.com/",600,400,200,200,);" type="text" />

-odobo

Thanks a lot odobo.
It's working.
But I can't understand the coding.
Could u plz explain about pop up messages some more.......???

Thanx n Regards
Yas.
Feb 26 '08 #3
odobo
11
hey yasmine...
no problem..
I wrote the function popUp, it accepts many parameters...
the only crutial ones that you need to supply are the first 5..
as follows:
1. the url to open in a pop up.
2. the width you want the pop up
3. the height you want the pop up
4. the location from the left of the screen in pixels
5. the location from the top of the screen in pixels.
now the rest of the parameters accept a 1 or a 0...
6. weather to show the toolbar on the pop up 1=yes 0=no
7. weather the user can resize the window 1=yes 0=no
8. weather to show scrollbars on the popup 1=yes 0=no
9. weather to show the menu bar on the popup 1=yes 0=no
10. weather to show the status bar on the popup 1=yes 0=no..
and oops!! 11 is wrong... at the end of this i will post code for that function again.. just replace with this new code.

so getting to the code...
when the function first starts executing, I am validating what was passed into the function and ensuring some default values..
like so..
Toolbar = Toolbar==null||Toolbar==""?1:Toolbar;
- this is called shorthand... it basically is an either or.
toolbar = if toolbar is null or if toolbar = "" then toolbar = 1. otherwise toolbar equals itsself - in other words dont change anything.
you could write the same thing like this...
if(toolbar==null)
{
toolbar = 1;
}else if(toolbar=="")
{
toolbar = 1;
}else
{
// dont do anything here... toolbar has a value.
}


now the next two lines have the purpose of generating an id.
this is not real necessary. but sometimes I will want to access the window i have created from another window so an id helps out.
the id is created from the time property of javascripts date object which is well the time that it is ..ie.. 12:41am.

and finally the last line in the function is where we actually create the new window. we use an eval function which is not important you are welcome to google that.. and we use the function create from the window object. which we then pass in all the parameters to tell it how to open.

the only other part of this is just using our simple function..
we can put the simple line of javascript code on any user control like the text box inside any kind of event handler like the onclick event that we used... you could put it inside an onkeydown event if you wanted to... in fact you dont have to put it in any control or handler really, you can put it anywhere that the code will execute. like just underneath the function outside of the braces of coarse..
[inside the braces would create a nasty loop opening up many pop-ups and that would be no fun] and it will pop up a window when the code executes as the page loads.

here is the revised function...

function popUp(URL,Width,Height,Left,Top,Toolbar,Resizeable ,ScrollBars,
MenuBar,StatusBar)
{
Toolbar = Toolbar==null||Toolbar==""?1:Toolbar;
Resizeable = Resizeable==null||Resizeable==""?1:Resizeable;
ScrollBars = ScrollBars==null||ScrollBars==""?1:ScrollBars;
MenuBar = MenuBar==null||MenuBar==""?1:MenuBar;
StatusBar = StatusBar==null||StatusBar==""?1:StatusBar;
day = new Date();
id = day.getTime();

eval("page" + id + " = window.open(URL, '" + id
+ "', 'toolbar="+Toolbar+",scrollbars="+ScrollBars+",loc ation=1,
statusbar="+StatusBar+",menubar="+MenuBar+",resiza ble="+
Resizeable+",width="+Width+",height="+Height+",lef t="+Left+",top="+Top+"');");
}

hope this helps ;)
-odobo

Thanks a lot odobo.
It's working.
But I can't understand the coding.
Could u plz explain about pop up messages some more.......???

Thanx n Regards
Yas.
Feb 26 '08 #4
yasmine
65
hey yasmine...
hope this helps ;)
-odobo
Thank u very much odobo.
So kind of u....
Now i understood clearly about pop up......
Thanx a lot........
Feb 26 '08 #5
nomad
664 Expert 512MB
hey yasmine...
no problem..
I wrote the function popUp, it accepts many parameters...
the only crutial ones that you need to supply are the first 5..
as follows:
1. the url to open in a pop up.
2. the width you want the pop up
3. the height you want the pop up
4. the location from the left of the screen in pixels
5. the location from the top of the screen in pixels.
now the rest of the parameters accept a 1 or a 0...
6. weather to show the toolbar on the pop up 1=yes 0=no
7. weather the user can resize the window 1=yes 0=no
8. weather to show scrollbars on the popup 1=yes 0=no
9. weather to show the menu bar on the popup 1=yes 0=no
10. weather to show the status bar on the popup 1=yes 0=no..
and oops!! 11 is wrong... at the end of this i will post code for that function again.. just replace with this new code.

so getting to the code...
when the function first starts executing, I am validating what was passed into the function and ensuring some default values..
like so..
Toolbar = Toolbar==null||Toolbar==""?1:Toolbar;
- this is called shorthand... it basically is an either or.
toolbar = if toolbar is null or if toolbar = "" then toolbar = 1. otherwise toolbar equals itsself - in other words dont change anything.
you could write the same thing like this...
if(toolbar==null)
{
toolbar = 1;
}else if(toolbar=="")
{
toolbar = 1;
}else
{
// dont do anything here... toolbar has a value.
}


now the next two lines have the purpose of generating an id.
this is not real necessary. but sometimes I will want to access the window i have created from another window so an id helps out.
the id is created from the time property of javascripts date object which is well the time that it is ..ie.. 12:41am.

and finally the last line in the function is where we actually create the new window. we use an eval function which is not important you are welcome to google that.. and we use the function create from the window object. which we then pass in all the parameters to tell it how to open.

the only other part of this is just using our simple function..
we can put the simple line of javascript code on any user control like the text box inside any kind of event handler like the onclick event that we used... you could put it inside an onkeydown event if you wanted to... in fact you dont have to put it in any control or handler really, you can put it anywhere that the code will execute. like just underneath the function outside of the braces of coarse..
[inside the braces would create a nasty loop opening up many pop-ups and that would be no fun] and it will pop up a window when the code executes as the page loads.

here is the revised function...

function popUp(URL,Width,Height,Left,Top,Toolbar,Resizeable ,ScrollBars,MenuBar,
StatusBar)
{
Toolbar = Toolbar==null||Toolbar==""?1:Toolbar;
Resizeable = Resizeable==null||Resizeable==""?1:Resizeable;
ScrollBars = ScrollBars==null||ScrollBars==""?1:ScrollBars;
MenuBar = MenuBar==null||MenuBar==""?1:MenuBar;
StatusBar = StatusBar==null||StatusBar==""?1:StatusBar;
day = new Date();
id = day.getTime();

eval("page" + id + " = window.open(URL, '" + id
+ "', 'toolbar="+Toolbar+",scrollbars="+ScrollBars+",loc ation=1,s

tatusbar="+StatusBar+",menubar="+MenuBar+",resizab le="+
Resizeable+",width="+Width+",height="+Height+",lef t="+Left+",
top="+Top+"');");
}

hope this helps ;)
-odobo
You should see you can post this in the Howtos section.

nomad
Feb 26 '08 #6
odobo
11
yas-
glad that helped.
-odobo

You should see you can post this in the Howtos section.

nomad
Feb 26 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: lothar | last post by:
i want to traverse a set of messages in a Yahoogroups group from a Python program. to get to the messages of the group, one must log in. this presents, i think, two problems, 1) handling the...
0
by: piyush | last post by:
Sorry for repeated posting but I couldnt get things right/completely in the first post. I am in the process of deciding the IPC mechanisms to use for communication between 1) An application...
5
by: Adam | last post by:
Hi, How do i listen for windows messages in c# on compact.net? I have a window containing an instantiation of the HTML viewer control, which is a child of the main form. As the compact...
0
by: piyush | last post by:
Sorry for repeated posts, I couldnt get things right and complete in the previous post. I am in the process of deciding the IPC mechanisms to use for communication between 1) An application...
5
by: zorhel | last post by:
Hi. My clients will be IE, Mozilla and Opera in a Windows and *nix OS. So, my web app need to, from a server, send messages to a specific client (browser), send messages for all clients,...
7
by: ucfcpegirl06 | last post by:
Hello, I have a dilemma. I am trying to flag duplicate messages received off of a com port. I have a software tool that is supposed to detect dup messages and flag and write the text "DUP" on...
0
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool...
26
by: Charlie Gordon | last post by:
Keith Thompson wrote this by private email: I've open an account with motzarella.org, and your last post does not show up there either. As a matter of fact, your messages show up on a very...
1
by: CodeSeeker | last post by:
I have an application, which uses pop3 to read the messages from the mailbox, and it has been working fine for so many year. We recently have started changing this application to use java mail IMAP 4...
18
by: Grant Edwards | last post by:
Could whoever is responsible for the gateway that is grabbing my postings off of Usenet and e-mailing them out please fix the headers in the mail messages so that I don't get the bounce messages?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.