monito Posted August 30, 2006 Share Posted August 30, 2006 I'm trying to pass a var_name from php to java, but I cannot get it to work... <?php $var_name = "some test <br />"; print $var_name; ?> <script type="text/javascript"> document.writeln(' <?php $var_name; ?> '); </script> Thanks, Monito Link to comment Share on other sites More sharing options...
jasonabc Posted August 31, 2006 Share Posted August 31, 2006 You will never get this to work. JavaScript (not Java - the two are *very* different!!) is a client-side scripting language (executed by the browser). PHP is a server-side language (executed by the webserver). You can use PHP to *populate* Javascript variables - but not to pass them. Here's an example: <?php $var_name = "some test <br />"; print $var_name; ?> <script type="text/javascript"> document.writeln('<?php echo $var_name;?>'); </script> Jason My Contributions: Paypal Payflow PRO | Rollover Category Images | Authorize.net Invoice Number Fix Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.