So I guess your config.php is your connection to the database.
In your form you will have something like
form.php
<form action="post" action="script.php">
<input type="text" value="" name="name" />
<input type="submit" name="commit" />
</form>
script.php
include_once('config.php');
// Do your db stuff
//close db connection
mysql_close($conn);
there are many ways in setting your site up. But this is one way if you dont need a db connection on every page. If you need to do db stuff as in you have custom session handling you can setup include_once('config.php'); in your index.php and at the bottom of your index.php close your mysql connection.
But you need to read up more on some PHP basics
GOODLUCK!