Well, building a CMS is a great learning experiance. However, I have spent the past year building a new CMS/Framework that can render pages within .004 of a second and has all the features someone could need. So if you wait to wait another month you can download it ;P
Anyway, here is how you would make a install file. You can also download phpBB and look at their install file.
<?php
/*
If someone pressed the "submit" button
(which can only happen if they have seen and filled out the form!)
*/
if(isset($_POST['submit'])) {
// Put the $_POST/form data into the file text
$text = '<?php'. "\n".
'$db_name = "'. $_POST['db_name']. '";'. "\n".
'$db_user = "'. $_POST['db_user']. '";'. "\n".
'$db_pass = "'. $_POST['db_pass']. '";'. "\n".
'$db_host = "'. $_POST['db_host']. '";'. "\n".
'$admin_name = "'. $_POST['admin_name']. '";'. "\n".
'$admin_pass = "'. $_POST['admin_pass']. '";'. "\n".
'?>';
// 1) Store the file name in a string (this is the file handle).
$filename = "config.php";
// 2) Open the file
$filehandle = fopen($filename, 'w')
// 3) Write the text above to the file
fwrite($filehandle, $text);
// 4) Close the file handle
fclose($filehandle);
//Now you have a file called "config.php" in the same place as the install.php file.
}
?>
Please Enter your Site Information:
<form action="" method="post">
Database Name: <input name="db_name" type="text" value=""><br />
Database User: <input name="db_user" type="text" value=""><br />
Database Pass: <input name="db_pass" type="text" value=""><br />
Database Host: <input name="db_host" type="text" value="localhost"><br />
<br />
Admin Name: <input name="admin_name" type="text" value=""><br />
Admin Pass: <input name="admin_pass" type="text" value=""><br />
<input name="submit" type="submit" value="Submit">
</form>