Re: Creating a Window without JavaScript that is on top

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Problem solved....

Todd

Todd Cary wrote:
How do I get the var into a php variable in the destination window?

Todd

Brady Mitchell wrote:
Personally, I think that posting a way to allow php to communicate with javascript OR any other language is relevant for a php-general list, don't you think?

To use the value of a PHP variable in javascript, you create a
javascript variable and then echo the value of the php variable. For example:

Say you have a $price variable set in your PHP script and you want to
use that in a JavaScript.

<?php
    $price = 50;
?>

<script language="javascript" type="text/javascript">
    var price = <?php echo $price; ?>;
</script>

Assuming you put this in a .php file, PHP will parse the file and echo
the price before the javascript makes it to the browser, so if you look
at the source of the document you'll see:

<script language="javascript" type="text/javascript">
    var price = 50;
</script>

HTH,

Brady

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux