Page 1 of 1

javascript window open problem in PHP Script..

Posted: Mon Mar 23, 2009 5:28 am
by pavanpuligandla
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


hii..
i've a javascript function open_window which opens a new window..
i wrote it in php script when clicked reads an image file and echos it on the window..
now when i'm trying to add another href link i'm getting syntax error..

here is my JavaScript open window function:

Code: Select all

function open_window(link,w,h) //opens new window
{
    var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
    wishWin = window.open(link,'wishWin',win);
}
My PHP Code

Code: Select all

<?php
        if ( file_exists("./products_pictures/".$picture["filename"])
             && trim($picture["filename"]) != "" ){
                
            echo $picture["filename"]."<br />
                <a class=small href='javascript&#058;open_window(\"products_pictures/".$picture["filename"]."\",".GetPictureSize($picture["filename"]).")'>".ADMIN_PHOTO_PREVIEW."</a>
                 &nbsp;|&nbsp; <a class=small href=\"javascript&#058;confirmDelete('".QUESTION_DELETE_PICTURE."', 'products.php?delete_one_picture=1&filename=".$picture["photoID"]."&productID=".$_GET["productID"]."')\">".DELETE_BUTTON."</a>
                 ";
 
        }else
            echo ADMIN_PICTURE_NOT_UPLOADED;
?>
i would like to replace the above HREF link with this link :
"./products_pictures/resizethumb.php?img={$product_info.picture}"
can anyone give me ideas?


pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.

Re: javascript window open problem in PHP Script..

Posted: Tue Mar 24, 2009 5:57 am
by sujithtomy
Hello,

Try this

Code: Select all

<?php
if ( file_exists("./products_pictures/".$picture["filename"])
              && trim($picture["filename"]) != "" ){
                 
             echo $picture["filename"]."<br />
                 <a class=small href='javascript&#058;open_window(\"products_pictures".$picture["filename"]."\",\"".GetPictureSize($picture["filename"])."\"); '>".ADMIN_PHOTO_PREVIEW."</a>
                  &nbsp;|&nbsp; <a class=small href=\"javascript&#058;confirmDelete('".QUESTION_DELETE_PICTURE."', 'products.php?delete_one_picture=1&filename=".$picture["photoID"]."&productID=".$_GET["productID"]."')\">".DELETE_BUTTON."</a>
                  ";
  
         }else
             echo ADMIN_PICTURE_NOT_UPLOADED;
 ?>

----------
Regards,
Sujith