So I have this issue with a script I am doing and I can't get it going for the life of me. I created an installer for a small script I am doing.From that installer I am wanting to create a config.php file and store the variables from the form in it ( ie username, password, db_name).
I know how to create and open a file and write to it some but how to do I place a template like
<?php
$username = ' justin'; < - justin being what the user used in the form when installing
$password = ' abc123 '; <- Same thing
?>
blah blah blah\

I am wanting to pass the information to the config file
right now I am using the idea

$configFileName = "config.php";
$configFileHandle = fopen($configFileName, 'w+')or die("can't open file");
$content = " <?php
$username = $username_input;
$password = $userpassword_input;
?>"
fwrite($configFileHandle,$content);
fclose($configFileHandle);

I know it is not right, but i am just no understanding how to get it to write out the config file like I want.
I forgot to add that the config file is for the information to connect to the database only. It will not hold any login name for the site.