Hi all,
This is the first time I have attempted to write a config file for a script, via an "install" form.
My config file is simple enough, comments and variables - nothing more.
My install page is a basic form, with which I require the entered fields to overwrite the variable settings in config.php
So far, in install.php I have an html form, and then the following code, which I think is write (no errors) but I know is incomplete:
$config_content="configs go here, not sure what syntax";
if ($submit) {
$file = fopen("config.php", "w+b");
if ($file == false)
{
die ('<br>Error opening the config file!');
}
$write = fwrite($file,$config_content);
echo "<strong>Installation complete!<br>";
}
How do I get the values from the form fields above this array to pass through the array and then write to the config file, in the correct places (so that the config file can be edited by hand as well, if required)? My config file looks like this:
//comments here
$this = "that";
//comments here
$x = "something";
...and so on.
Any ideas?