View Single Post
Old 09-27-2012, 06:38 PM   PM User | #1
sanomani
New Coder

 
Join Date: Jun 2012
Posts: 26
Thanks: 9
Thanked 0 Times in 0 Posts
sanomani is an unknown quantity at this point
Help! textarea value doesnt insert into msql database

With thanks to all coders here who have contributed and made the forum a success..

I am stuck with, may be a very basic problem.
I have an html form with some input fields.
I've tried the following:

msql part
Code:
-- database connection information --
mysql_query("INSERT INTO `article` (user, desc) VALUES('{$posts['name']}', '{$posts['desc']}')");
echo "added successfully!";
And the form part
1.
Code:
<form method="post">
<input name="name" value="<?php if(isset($posts["name"])) { echo $posts["name"];}?>"/>
<input name="desc" value="<?php if(isset($posts["desc"])) { echo $posts["desc"];}?>"/>
* This works fine but..

2.
Code:
<form method="post">
<input name="name" value="<?php if(isset($posts["name"])) { echo $posts["name"];}?>"/>
<textarea rows="10" name="desc" value="<?php if(isset($posts["desc"])) { echo $posts["desc"];}?>"/>
* This doesnt insert the value into msql database.


The only difference between 1 and 2 is, 1 has input name="desc" and 2 has textarea name="desc"

How can I solve this?
sanomani is offline   Reply With Quote