To send the textarea text value in any HTML forms to the web server and store it into a MySQL table by PHP, you will need to POST the textarea data to a PHP script and then the PHP script would connect to a MySQL database to put the data into one of the tables by inserting a record or updating one.
The HTML:
<textarea rows="10" cols="10" name="bio"></textarea>
Now the visitor has finished typing in his text and clicked the submit button. The data is then transmitted via POST method to a PHP script:
$data = $_POST['bio']; // because the name attribute of the textarea tag is 'bio'
$data = mysql_real_escape_string[$data]; // necessary step before using the data string to prevent SQL injection attacks
mysql_query("INSERT INTO `authors` (`bio`) VALUES ('$data')");
By committing the last SQL query, the bio data entered by the visitor is successfully inserted into the table `authors` as a new record. Other than this, you may also want to use:
UPDATE `authors` SET `bio` = '$data' WHERE ...
To update an existing row with the textarea data instead of inserting a new one.
I think that’s pretty much what the basics look like to put textarea value into a database.
Related Posts
- MySQL, PHP: Display MySQL table fields and data
- How to Transfer / Move WordPress Blog from One Domain to Another
- MySQL: Insert if doesn’t exist otherwise update the existing row
- MySQL: Update Multiple Rows or Records with One Single Query
- MySQL: Replace Substring with Another String – the MySQL String Replace Function

{ 3 comments… read them below or add one }
For some reason your use of backticks here prompted me to fix the problem I was having. Thanks!
If you dnot want to allow the user to enter the html code in the textarea then you can use the PHP function [ strip_tags() ] to remove the thml tags from the text entered.
This function will also remove the javascript.
Nice catch, Farrukh!