View Full Version : Text Fireld Writting Back to a Database

07-21-2010, 11:45 AM
Hi All,

How do I get a text field to write back to a table attribute in a mysql database?

I'm a newbie to all this so please go easy!

Many Thanks

07-21-2010, 04:15 PM
What language are you planning to use?

07-21-2010, 04:34 PM
I'm hoping to use PHP but am a beginner to the whole process. I'm in the middle of watching the tutorials attached to this site but any help is definatly welcomed.

Many thanks

07-21-2010, 04:47 PM
OK, give your text field a name and then have the action set to "" (this will process the form on that particular page. If you want it separate then set the URL as the file path action) and the method to 'post'.

I am also assuming that you have written the PHP to find and log in to your database!

Then something like;

//this collects the text from the form
$text = $_POST['name'];

//this adds it to the database

//this updates the list of who is attending
mysql_query("INSERT INTO table (text) VALUES ('$text')");

Bear in mind this is really basic and you'll need to change the variable and database name and fields to suit.

If you really want to get with PHP I have two recommendations; http://devzone.zend.com/article/625 and http://codezenith.co.uk/