Forum Moderators: coopster

Message Too Old, No Replies

links open in popup passing a query string

l

         

magua100

4:28 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



I am new to PHP and can't figure this one out.

I want to have a link open to a popup and display the contents based on the ID # that i passed along with it.

Here is what i have so far but it does not disply the data.

<!-- Begin
function popUp(URL) {
mywindow = window.open(URL, "newwin", 'toolbar=0,scrollbars=,location=1,statusbar=1,menubar=1,resizable=1,width=400,height=300,top=60,left=60');
}
// End -->
</script>

echo "<A HREF=javascript:popUp('current_record.php?prospectID=";
echo $ID;
echo "')>Open Popup Window</A>";

Any help would be greatly appreciated.

ChadSEO

5:06 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



magua100,

What exactly is it doing wrong? Is it not displaying the link for the pop-up correctly? Is the pop-up window not displaying the what it should? If the pop-up window opens at all, does it have the correct ID in the URL?

Chad

magua100

5:14 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



When the link is click it open in the new window correctly however it does not display the content because it is not passing th ID number

ChadSEO

5:20 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



magua100,

On the original page, does it show the link correctly, or is it missing the ID as well? The code you posted should work, so if there is no ID listed, then the $ID is probably not getting set properly.

Chad

magua100

5:30 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



The ID number shows up as u mouse over the link.

ChadSEO

5:33 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



Well, assuming the URL in the pop-up window still has the ID (and there's no reason it shouldn't), then the page that generates the pop-up window must not be getting the ID correctly. You should be accessing it by using something like: $ID = $_GET['prospectID'];

Chad

magua100

5:34 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



here is the actualy page

Just mouse-over the link "openPopupWindow" on the
left-hand side. It is hard to see the font is white on a light background.

magua100

5:34 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



no personal urls, please
Terms of service [webmasterworld.com]

Thanks ;-)

[edited by: coopster at 7:04 pm (utc) on Aug. 30, 2005]
[edit reason] removed personal url [/edit]

ChadSEO

5:42 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



magua100,

Just a reminder (or a notice, since you're new :)), it's against the Terms of Service (TOS) to post any URLs to personal sites. In the future, it's better to send info like that directly to someone using the stickyMail.

That being said, when I go to that site, all I get is a login prompt.

Chad

ChadSEO

5:51 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



magua100,

I was able to view the page anyway (META refreshing is not the most secure way to require logins), and it looks like the current_record.php is not grabbing the ID correctly.

Also on the show_all_data_POPUP.php page, the link is showing up like this:

<A HREF=javascript:popUp('current_record.php?prospectID=4')class=nav3>

It should look more like this:

<A HREF="javascript:popUp('current_record.php?prospectID=4')" class="nav3">

Note the double quotes, and the space before "class".

Chad

magua100

6:00 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



that works if i want to hard code the ID.
but i need the ID Dynamic.

ChadSEO

6:07 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



magua100,

The following code will print out the link in a little better format, with the right spacing:

echo "<A HREF=\"javascript:popUp('current_record.php?prospectID=" . $ID . "')\" class=\"nav3\">Open Popup Window</A>";

This would replace the 3 lines you had in your original post.

Chad

magua100

6:07 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



<A HREF="javascript:popUp('current_record.php?prospectID=<? echo $ID?>')" class="nav3">Link</a>

I have tried the follow code but it still does not pass the varible. The id does show up in the link on mouse over.

magua100

6:10 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



Chad

echo "<A HREF=\"javascript:popUp('current_record.php?prospectID=" . $ID . "')\" class=\"nav3\">Open Popup Window</A>";

the above has the same results.
Boy php can be picky.

BTW
Thanks for all your help

ChadSEO

6:12 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



magua100,

It sounds like the ID is getting passed just fine. Perhaps the current_record.php is not pulling the ID from the URL properly. Can you tell me how you get the ID in current_record.php? It should be something like:

$ID = $_GET['prospectID'];

Chad

magua100

6:16 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



chad

$ID = $_REQUEST['prospect_ID'];

Magua

magua100

6:20 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



Chad
I just changed it toe GET, however the result is the same.
I also tried writing $ID to the screen but the value is empty.

magua100

6:22 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



Got it. Thanks so much for your help.

What can u tell me about meta refresh?

ChadSEO

7:08 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



Anyone can get around the meta refresh with a browser that ignores it, which includes tools like wget for Linux. A better solution would be to do a redirect in the header, like this:

<?php
header("Location: http://www.example.com/login.php"); /* Redirect browser */
/* Make sure that code below does not get executed when we redirect. */
exit;
?>

This will send the browser directly to the login page, instead of loading the content and then "suggesting" with a meta tag to go to a new page.

Chad