GET Problems...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tommy1987
Forum Commoner
Posts: 92
Joined: Tue Feb 21, 2006 8:35 pm

GET Problems...

Post by tommy1987 »

I am trying to make an image so people can click on it for a larger picture in a new window, the new window is appearing but it is not getting the URL passed to it using GET. This seems strange to me because it works when opened in the same window (i.e. If I copy shortcut), just not when opened in the popup window. The link appears correct in the bottom left of the browser when hovered over, however when it opens the new window it just displays the standard URL with no passed variables as the link had.

Here is the code:

Code: Select all

<A HREF="imgzoom.php?imgfile=<?=$imgurl?>"
onClick="popup = window.open('imgzoom.php', 'PopupPage', 'height=600,width=540,scrollbars=yes,resizable=yes'); return false" target="_blank">
<img width="75" 
         height="75" 
         src="<?=$imgurl?>" 
         valign="top" 
         style="border:1px solid gray;" 
         alt="<?=$name?> - Click for closeup" 
/>
</a>



my code for the new window:

Code: Select all

<?php
if(isset($_GET['imgfile'])) {
  echo 'URL FOUND!';
  $imgurl = $_GET['imgfile'];  
} else {
  echo 'URL NOT FOUND!';
}
?>
<html>
  <body bgcolor="#B2B2B2" align="center">
    <img src="<?=$imgurl?>" width="500" height="500" alt="" style="border:1px solid gray;" align="center" />
    <br/><br/>
    <center><a href="javascript:self.close()">Close Preview</a></center>
  </body>
</html>
User avatar
wtf
Forum Contributor
Posts: 331
Joined: Thu Nov 03, 2005 5:27 pm

Post by wtf »

try this

Code: Select all

<A HREF="javascript:;"
onClick="window.open('imgzoom.php?imgfile=<?=$imgurl?>'
.....
tommy1987
Forum Commoner
Posts: 92
Joined: Tue Feb 21, 2006 8:35 pm

Post by tommy1987 »

thanks I should have spotted something that simple... it was late :D
Post Reply