PHP HelpPHP Help

Online Community that helps beginners learn PHP,
and webmasters solve PHP coding problems

since 1999





Basics of the Configuration File

Getting Input from the User

To use this all you need is a form with inputs matching the variable names. The values get submitted and then written out as variables in the configuration file. When the configuration file is loaded by the application, the submitted values are available.

I've designed a form for use with the setup script.

<form action="setup.php" method="POST">

<style>
td { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #333333 }
  .formhed { background-color: #cccccc; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #333333 }
  .intputhed { background-color: #eeeeee; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #333333 }
</style>

<table cellspacing="2" cellpadding="5">
   <tr class=intputhed>
      <td colspan="2" class=formhed>Setup </td>
   </tr>

   <tr class=intputhed>
      <td>Database User Name</td>
      <td><input type="Text" name="db_user" size="24" value="<?php echo $db_user?>"></td>
   </tr>

   <tr class=intputhed>
      <td>Database Password</td>
      <td><input type="password" name="db_pass" size="24" value="<?php echo $db_pass?>"></td>
   </tr>

   <tr class=intputhed>
      <td>Database Host</td>
      <td><input type="Text" name="db_host" size="24" value="<?php echo $db_host?>"></td>
   </tr>

   <tr class=intputhed>
      <td>Database Name</td>
      <td><input type="text" maxlength=60 size="24" name="db_name" value="<?php echo $db_name?>"> </td>
   </tr>

   <tr class=intputhed>
    <td>Database Table</td>
    <td><input type="text" maxlength=60 size="24" name="db_table" value="<?php echo db_table?>"> </td>
   </tr>

   <tr class=intputhed>
    <td>Full Path</td>
    <td><input type="text" maxlength=60 size="24" name="base_path" value="<?php echo $base_path?>"> </td>
   </tr>

   <tr class=intputhed>
    <td colspan="2">
       <input type="Hidden" name="action" value="update_config">
       <input type="Submit" value="Next >>"> </td>
   </tr>

</table>

</form>
 
Pages:  1   2   3   4Next:  Security Concerns »




Copyright © 2017 PHPHelp.com