Jump to content

1 line syntax help...


justAnoob

Recommended Posts

<?php
echo '<a href="' . $row['imgpath'] . '"     //197
onClick="window.open(\'".$row['imgpath']."\', width=350, height=350); return false">    //198
<img src="' . $row['imgpath'] . '" width="150" alt="" border="0"></a>';   //199
?>

 

error on line 198  expecting , or ;

 

this is what I got before.

Link to comment
https://forums.phpfreaks.com/topic/160420-1-line-syntax-help/#findComment-846501
Share on other sites

the code below works,, except for the size of the window that opens... It opens as a full screen browser window,,,I don't want that.

<?php
echo '<a href="' . $row['imgpath'] . '" 
      onClick="window.open("'.$row['imgpath'].'", width=350, height=350); return false">
      <img src="' . $row['imgpath'] . '" width="150" alt="" border="0"></a>';
?>

Link to comment
https://forums.phpfreaks.com/topic/160420-1-line-syntax-help/#findComment-846543
Share on other sites

Thanks,, I'll never get a reply in the javascript board.

 

That reminds me, you keep posting in the wrong section, you know thats against the terms!

Do take the time to post in the proper section.

 

The Javascript section does get replies (I also go their)

Link to comment
https://forums.phpfreaks.com/topic/160420-1-line-syntax-help/#findComment-846563
Share on other sites

I would go with what MadTechie posted in Reply#4, except there was an errant, extra single quote at the beginning of the image src attribute

 

<?php
echo "<a href=\"{$row['imgpath']}\" onClick=\"window.open('{$row['imgpath']}', width=350, height=350); return false\"><img src=\"{$row['imgpath']}\" width=\"150\" alt=\"\" border=\"0\"></a>";
?>

Link to comment
https://forums.phpfreaks.com/topic/160420-1-line-syntax-help/#findComment-846673
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.