Coding & Programming > JavaScript Forum

how to php variable value assign as java script


Hi-Tech ITO:

var id=`$`php;

i have add php variable store as JavaScript. but some thing wrong in my code. what wrong with there please help me

Shikha Singh:
//somewhere set a value
$var = "a value";

// then echo it into the js/html stream
// and assign to a js variable
spge = '<?php echo $var ;?>';

// then


I guess you can use cookies for it.
First add a cookie jquery plugin.
Then store that window width in a cookie variable.
Access your cookie in PHP like $_COOKIE['variable name'].


[0] Message Index

Go to full version