Edit PHP config file from HTML form
<p>Here's my config file:</p>

<pre><code>&lt;?php
#config variables
$host =         ''; #your database host
$user =         ''; #your database username
$password =     ''; #your database password
$database =     ''; #your database title
$page_title =   ''; #this appears at the top of the webpage and in the browser tab/window.
$tbl_prefix =   ''; #the prefix on your database tables. 
$installed =    false; #if false, you'll be redirected to an installation page.


if($installed == false) {
    header('Location: install/index.php');
}
else {
#connect to db
$consult_err = ' Consult &lt;a href="lib/sqlerrors.html"&gt;lib/sqlerrors.html&lt;/a&gt;';
$connect = @mysql_connect($host, $user, $password) 
       or die('Errno(1) - Invalid connection details.' . $consult_err); 
           @mysql_select_db($database, $connect) 
             or die('Errno(2) - Couldn\'t connect to database.' . $consult_err);  #select database
}
?&gt;
</code></pre>

<p>I have an installation script that gets all the variables above from a user, checks to make sure there's a mySQL connection/database present, and creates some tables. However, I haven't found a good way to edit the above file with the user's input. </p>

<p>I'm rather stuck on where to go from here, but I need the end result to be taking input from a form, and having the variables in the configuration file reflect that input.</p>

<p>Any suggestions?</p>
