please help me with this. i have the following code that i can retrieve value from an external js file
$phpBsetB= "<script>document.write(BsetB)</script>";
echo $phpBsetB;
lets assume that BsetB stores a string "abcde". the code above will simply print out whatever the variable BsetB which is abcde. my question is, if i add the following code
$handle = fopen("test.js", "w");
fwrite($handle, $phpBsetB);
fclose($handle);
what will be saved in test.js is not abcde, instead, it saved
<script>document.write(BsetB)</script>
is there any way that i can make it saves abcde? thank you very very much for the help!
thank you guys for the quick help! i think i need to explain more of what im trying to do. maybe you guys can find a better way to solve this. i have a webpage which loads an external flat file called test.js. in the test.js, i've declared some variables in there. what i'm trying to do is, this webpage currently reads all the variables from test.js correctly, but it won't write/update test.js file. i want the webpage be able to write/update this test.js. since javascript cant write on server side, im trying to use php to write. the point is...i need to load the test.js file, so i can write/update it. my webpage currently uses js to read, so thats why my code is soo confusing now...i only know how to read js file using javascript. after i retrieve the value, i need to pass this js variable to php. or perhaps i should create the php flat file instead of js? really appreciated for your help!!!