Convert php variable to javascript variable
by Nirmala[ Edit ] 2008-10-16 17:57:12
Hi...
Whenever you want to convert from php variable to javascript variable see the below example and use it.
<?php
$xx=10;
?>
I have to assign $xx value to javascript variable means
<script type="text/javascript">
var pp=<?php echo $xx; ?>;
alert(pp); //You will get the answer as 10.
</script>
You want to assign $xx value to textbox means
<input type=text value='<?php echo $xx; ?>'>