Forum Moderators: coopster
I am hoping someone can assist me. I'm fairly new with php.
I am trying to open an image in a new window:
<?
echo '<a onClick="window.open(' . $mosConfig_live_site . '/works/pfolder/thumb/thumb.php?src='. $mosConfig_absolute_path . '/images/place/'. $row1->picture . '&x=750&y=600&f=0,\'newwin\',\'width=750,height=600,toolbar=no\');return false;" target="_blank">Click Here</a>';
?>
The window will not open, however, going to the actual page and viewing the source, I see that the url is correct (http://thesiteurl/works/pfolder/thumb/image.jpg&x=750&y=600&f=0) and I can go to that url in my browser and the image pulls up just fine.
Is my coding completely off? Am I missing something? Any suggestions?
You are also using the short opening php tags. Have you used them on other scripts? If not try opening with <?php and see if that sorts it out.
Is the variable $row1->picture getting passed correctly? Try print_r($row1) to check if the object is getting through.
And thank you very much for responding.
Right after posting I realized that I still had the return false in there and immediately took it out, but the window still would not open.
I used the short <? only in this board because some boards they want you to post it within the php tags, but its not like that in my actual script.
This is how I ended up getting it to work:
<?
echo '<a onClick="window.open(\'' . $mosConfig_live_site . '/works/pfolder/thumb/thumb.php?src='. $mosConfig_absolute_path . '/images/place/'. $row1->picture . '&x=750&y=600&f=0';
echo '\',\'newwin\',\'width=750,height=600,toolbar=no\')"><img src="'. $mosConfig_live_site . '/works/pfolderthumb/thumb.php?src='. $mosConfig_absolute_path . '/images/place/'. $row1->picture . '&x=145&y=200&f=0\'"></a>';
?>
The original one was not printing a "," and a couple of ' correctly.
Thanks again for offering your assistance.