68thorby68 4 Junior Poster in Training

Hi All,

I may be trying to achieve the impossible, but I'm trying to populate 2 iframes with PHP generated variables via a javascript function. I all seemed do simple to begin with but trying to mix client side action with server side data I seem to be going round in circles.

I have a simple piece of php, executing a javascript function

while($row=mysql_fetch_array($result))//Array or records stored in $nt
{
$ipath = $row['image_path'];//example <img src="mypics/picname.gif" />
$iname = $row['image_name'];//example "text to describe the image

echo "<p><a href='javascript: puttext()'>".$iname."</a>";

when I click the link, I want the javascript to populate 2 iframes, 1 with an ID of view_pic, 1 with an id of view_text.

my javascript function in the HEAD tags is

function puttext(){
window.open('<?php echo $ipath; ?>','view_pic');
window.open('<?php echo $iname; ?>','view_text');
}

But I am getting nowhere.

The reason I constructed the javascript call and the javascript function as above os two fold:

1: using an onclick call in the php just does not want to work.
2: I have used the javascript function window.open('url','target'); in a onclick function on another site.

Please can someone please let me know if i'm close to a solution, or if my eventual aim is impossible.

Many thanks.