javascript window open problem in PHP Script..

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
User avatar
pavanpuligandla
Forum Contributor
Posts: 130
Joined: Thu Feb 07, 2008 8:25 am
Location: Hyderabad, India

javascript window open problem in PHP Script..

Post 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.
sujithtomy
Forum Commoner
Posts: 46
Joined: Tue Mar 24, 2009 4:43 am

Re: javascript window open problem in PHP Script..

Post 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
Post Reply