"Cpt John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> From: "Kenn Murrah" <[EMAIL PROTECTED]>
> > I need to be able to pass a PHP variable to a Javascript and can't
> > figure out how to do it.  In short, the Javascript win() statement is
> > used open a page as defined in PHP -- i.e., $php_name =
> > "http://www.somewhere.com/something/3.jpg"; , a filename that was
> > generated dynamically in PHP ... how do I pass that variable to my
> > Javascript routine?
>
> <script language = "JavaScript">
> var mywin = '<?=$php_name?>';
>
> win(mywin);
>
> </script>
>
> or something like that.
>
> ---John Holmes...

Yes, is that simple, but if it doesn't work for you (because of the short
tag <?= ) use the 'echo' or 'print' commands:
    [... php code ... ]
    ?>
    <script language = "JavaScript">
    var mywin = '<?php echo $php_name; ?>';

    win(mywin);

    </script>
    <?php
    [... more code ... ]

- Good luck

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to