How to pass scalar data in PHP?

To pass scalar data held in a PHP variable ( $val) to a JavaScript variable, place the following in a JavaScript segment: var val = “<?php echo $val ?>”; Notice the quotes around the PHP tags. This will result in a string value in JavaScript which you may need to convert for use in your scripts. If the PHP value is numeric, you don’t need …
For More Information Please Refer:


You May Also Like to Read: