I just finished with something exactly like this...
what I did was have the form on one page (I included the vars to start with so I could load the currecnt values into the form)
then the submit button lead to another page.
this other page had something like this in it...
<?php
$sf = "<?php\n";
$sf .= "\n\$variable = \"$HTTP_POST_VARS[variable]\";";
--repeat for other variable--
$sf .= "\n?>";
$setfile = fopen("settings.txt", "w");
fwrite($setfile, $sf);
fclose($setfile);
}
?>
then to use them later on you just
include("settings.txt");
at the start of the file you want to use them in and just use them as you would if you had just declared them