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);
FCLOSE($fp);
 
}
 
<form action="" method="post" name="install" id="install">
  <p>
    <input name="dbhost" type="text" id="dbhost" value=""> 
    DB Host
</p>
  <p>
    <input name="dbunam" type="text" id="dbunam"> 
    DB Username
</p>
  <p>
    <input name="dbpas" type="password" id="dbpas">
  DB Pass </p>
  <p>
    <input name="dbname" type="text" id="dbname" value=" ">
  DB Name </p>
  <p>
    <input name="prefix" type="text" id="prefix">
  DB Prefix</p>
  <p>
    <input name="user_prefix" type="text" id="user_prefix">
  Userprefix</p>
  <p>
    <input name="pluginsdir" type="text" id="pluginsdir">
  Plugins Dir </p>
  <p>
    <input type="submit" name="Submit" value="Install">
  </p>
</form>

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.

http://uk3.php.net/manual/en/function.file.php
http://uk3.php.net/manual/en/function.file_get_contents.php

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