Use php value inside java script function

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
mit
Forum Commoner
Posts: 32
Joined: Mon Sep 15, 2008 6:37 am

Use php value inside java script function

Post by mit »

Code: Select all

<?php
          for ($i=0; $i<sizeof($res) ;$i++){
            $uploadid = $res[$i]['id'];
 
echo ("<Script Language=JavaScript>
function load() {
var load = window.open('viewgallery.php?uploadid=$uploadid','','scrollbars=no,menubar=no,height=580,width=520,resizable=yes,toolbar=no,location=no,status=no');
       }
      </Script>");
            ?>
   

I need to call $uploadid inside the function load , upload id has got few values ,that s why i need to put function inside php codes.but this way is not working,any help
User avatar
HCBen
Forum Commoner
Posts: 33
Joined: Thu Jun 22, 2006 3:15 pm
Location: Indiana

Re: Use php value inside java script function

Post by HCBen »

You're missing the close bracket for the for loop.
Post Reply