PDA

View Full Version : Form generation by PHP and storage in MySQL


codewarrior
09-11-2002, 09:47 PM
I'm thinking of creating a simple script that would gen a form that would let users store information on a mysql DB. The question's how do I go about this task? :confused:

Nightfire
09-11-2002, 10:42 PM
Whatcha wanna know? How to set up the DB or how to store info, or both?

codewarrior
09-12-2002, 05:11 AM
Well I know how to read stuff off of DB using php and display so I am pretty much interested in how do we create a forum that sends data to DB. Thanks in advance ;)

Spookster
09-12-2002, 06:09 AM
Well since you know how to pull data from the DB using php then I must assume you know how to set up the connection and run a SQL Select statement.

To put stuff in you use a SQL Insert statement.

Other than that as far the form goes each element of the form becomes available to php via server variables. So if you had an input box:

<form method="post" action="input.php">
<input type="text" name="yaks">
<input type="submit" value="Submit">
</form>

When the form is submitted the value of that form element input box becomes available to php like so:

$yaks = "_POST["yaks"]; //assuming register globals is off

or

$yaks = "HTTP_POST_VARS["yaks"]; //assuming register globals is on

Then just use that variable as the value you insert into the DB.

codewarrior
09-12-2002, 06:50 PM
Thanks alot! :thumbsup: