Results 1 to 2 of 2
-
April 9th, 2007, 01:42 PM #1
How to send Form data to a MySQL database creater?
Ok... I have 4 php files:
Now config holds all the MySQL connect data, opendb open the MySQL database, create puts the tables in the database, closedb closes the database.Code:config.php opendb.php closedb.php create.php
What I want to know is what php file I add a form to and how do i do this:
A form with 4 inputs and a buttons (host, username, password and database) which will determine what details to use when loggin onto the MySQL db...
How will I do this?
-
April 10th, 2007, 05:59 PM #2197Registered User
postsfirst off, not sure why u wanna be doing this, but thats ur part to think about...
second, why do u have four files for such simple actions as opening ur connection, closing your connection etc.?
once again, thats for u to think about too...
to ur question:
use an html form, with four <inputs>, each with a name that associates to what the data is, such as:
Then, have a submit button (if you don't know how to add a submit button, I suggest you learn plenty about HTML and some basic PHP first before doing this, otherwise you could be opening your system up to some serious security flaws).Code:<input type="text" name="host">
The form will submit to config.php using a POST, and grab that data by in ur PHP file doing:
$host = $_POST['host'];
Then use the variable $host in your connection info to the DB."First time it's a mistake, do it again and it's stupidity."


Reply With Quote

Bookmarks