DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

Passing a URL variable from a php page to a pop up window (another php page)

By: | 18 Feb 2009 4:25 pm

Hello,

I have this link that, when clicked,oppens a popup window.I need to pass an "id" to the new window so that the php script could process the page.I dont really want a form and a hidden field.

The popup window .. which is a php page .. opens alright, but the id value is not passed. What is wrong?

The link is like :
 
<A HREF=`#` onClick=`check(); return false;`>click here</A>
 
function check() {
window.open(`?id=123456789`, `name`, `toolbar=0,  titlebar = 0, status=0,
scrollbars=0, menubar=0, resizable=0, width =360, height=250,left=220,top=175`);
}
It is the id value in the URL that I want to pass on to the popup window.
 
The point is that if I use a normal link like so:
<a target="_blank" href="?id=123456789">click here</a>

 
The script works fine.

Any idea?
 

Comments

The best way to do it is a catch all.

<a href="page.php?id=123" onclick="openpop(this.href); return
false">Click</a>

If js is enabled, it will open the pop, then return flase to stop the click event of the <a> from taking place.

By: | 18 Feb 2009

Also try a fully-qualified URL (eg http://www.example.com?id=123456789).

By: | 18 Feb 2009

The script`s name must be there but in addition one has to pass the id value to the function as well. So it would look‚ something like this:
function check(ID) {
window.open(`popuppage.php?id=` + ID, `name`, `toolbar=0,
titlebar = 0, status=0, scrollbars=0, menubar=0, resizable=0, width
=360, height=250,left=220,top=175`);
}
<a href=`#` onClick=`check(1234567); return false;`>click here</a>

By: | 18 Feb 2009

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move