Javascript can only make temporary changes for one user. PHP can actually change a file, thus the changes are universal.
The easiest way to edit with fwrite would be to include one more JS file that only has the values. For example:
Code:
var one = "one";
var two = "two";
Then you would include the other file.
With PHP, you can do something like this:
PHP Code:
<?php
$values = "var one = \"".$_POST['FORM_INPUT_NAME_1']."\";
var two = \"".$_POST['FORM_INPUT_NAME_1']."\";";
$file = fopen('./file.js','w');
fwrite($file, $values)
fclose($file);
?>
After running that PHP script, the javascript file will look something like this:
Code:
var one = "new value";
var two = "new value";
You can also have it read in your JS file and edit it, that way you wouldn't have to create a second JS file, but that would be a bit harder to do.
I am not sure if this is what you need, so let me know.
Bookmarks