Need help with reading a file for a form

Hi i am right now working on making a admin area for a website and am trying to make the config file so it can be changed with a form for easy of use. i have been able to write to the config.php file i have but i cant seem to figure out how to read each line from it to display back in the form for when text is in the config file already. right now it is jsut displaying blank pages.

here is the form page code

IF (ISSET($_POST["Submit"])) {
$string = '<?php 
$dbhost = "'. $_POST["dbhost"]. '";
$dbuname = "'. $_POST["dbunam"]. '";
$dbpass = "'. $_POST["dbpas"]. '";
$dbname = "'. $_POST["dbname"]. '";
$prefix = "'. $_POST["prefix"]. '";
$user_prefix = "'. $_POST["user_prefix"]. '";
$smarty->plugins_dir = "'. $_POST["pluginsdir"]. '";
$fp = FOPEN("config.php", "w");
FWRITE($fp, $string);
<form action="" method="post" name="install" id="install">
    <input name="dbhost" type="text" id="dbhost" value=""> 
    DB Host
    <input name="dbunam" type="text" id="dbunam"> 
    DB Username
    <input name="dbpas" type="password" id="dbpas">
  DB Pass </p>
    <input name="dbname" type="text" id="dbname" value=" ">
  DB Name </p>
    <input name="prefix" type="text" id="prefix">
  DB Prefix</p>
    <input name="user_prefix" type="text" id="user_prefix">
    <input name="pluginsdir" type="text" id="pluginsdir">
  Plugins Dir </p>
    <input type="submit" name="Submit" value="Install">

and here is what gets written to the config file

$dbuname = "user";
$dbpass = "somepass";
$dbname = "namewho";

any help on this would be great. been looking online and couldnt find anything that would help with this.

You will need either file() or file_get_contents() to get the contents of the file.
file() gets it and puts it all in an array - one line per array entry
file_get_contents() puts it all in a string.

Once you have the content you will need to manipulate it. Have a browse through the string functions and/or regexp

ok thank you will look into those