Re: Variables
| From: | Ben Ramsey | Date: | Thu, 15 Jan 2004 23:15:50 +0000 |
| Subject: | Re: Variables | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174730@lists.php.net to get a copy of this message | ||
AH> How do you insert a php variable into a javascript function? AH> function redirect(<?php $MyVar ?>) { location = <?php $MyVar ?>; } function redirect (<?=$MyVar?>) { location = <?=$MyVar?>; }or use: function redirect (<?php echo $MyVar; ?>) { location = <?php echo MyVar; ?>; } The short syntax only works with short_open_tag enabled in php.ini or with ini_set(). -Ben