use php var in javascript

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

crue
New php-forum User
New php-forum User
Posts: 9
Joined: Sun Jun 22, 2003 6:51 pm

use php var in javascript

Postby crue » Thu Jun 26, 2003 12:54 pm

Hi,

I have a button called 'view' and as I click it, I want to dynamically generate a pop-up window whose content from some php var........
I tried: (inside php file)
<?php
$temp = "pic.jpg";
?>
<input type='submit' value='view' OnClick="window.open('<?php $temp ?>','myWindow')">
It failed......................

thanx,
crue

liquedus
php-forum Active User
php-forum Active User
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada
Contact:

Postby liquedus » Thu Jun 26, 2003 12:57 pm

<input type='submit' value='view' OnClick="window.open('<?php echo $temp; ?>','myWindow')">

enjoy! :D

crue
New php-forum User
New php-forum User
Posts: 9
Joined: Sun Jun 22, 2003 6:51 pm

Postby crue » Thu Jun 26, 2003 1:53 pm

I can't believe I missed that.......

thank's liquedus,
it works fine now


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests

cron