jaydeesmalls Posted January 22, 2009 Share Posted January 22, 2009 Hi everyone, I have a text area in my form, and I cannot figure out how to pas the info inputted into the db. my code reads like this <table> <tr> <td>Proposer's Name:</td> <td width="20px"> </td> <td><input type="text" width="30" name="name" /></td> </tr> <tr> <td>Today's Date MM/DD/YY</td> <td width="20px"> </td> <td><input type="text" width="30" name="userdate" /></td> </tr> </table> <br /> <br /> <question> 1. What is the proposed change? (please avoid complex acronyms and use common terminology)<br /> </question> <answer> <textarea rows="4" cols="100" id="q1" /></textarea> </answer> and gets processed by this $query="INSERT INTO $tbl_name (name, userdate, q1) VALUES ('$name', '$userdate', '$q1')"; $result=mysql_query($query); The "name" and "userdate" fields populate properly in the db, but not the textarea. Any help would be appreciated. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/142044-textarea-help-please/ Share on other sites More sharing options...
elflacodepr Posted January 23, 2009 Share Posted January 23, 2009 Well first of you will need a text area in your HTML code not "<question>" as you have written because theres not way you can write the text area if you havent assigned it a 'name' to pass it to PHP then to DB, heres how your code should look: <table> <tr> <td>Proposer's Name:</td> <td width="20px"> </td> <td><input type="text" width="30" name="name" /></td> </tr> <tr> <td>Today's Date MM/DD/YY</td> <td width="20px"> </td> <td><input type="text" width="30" name="userdate" /></td> </tr> </table> <br /> <br /> 1. What is the proposed change? (please avoid complex acronyms and use common terminology)<br /> <textarea rows="5" cols="30" name="comments"></textarea> I'm not sure what you mean with '<answer>' tag so I deleted it Ok, add this to your PHP file so you can write the "text" area to your DB: $q1 = $_POST['comments']; //this is textarea Also make sure you clean everything before being passed to DB! use mysql_real_escape_string Quote Link to comment https://forums.phpfreaks.com/topic/142044-textarea-help-please/#findComment-743900 Share on other sites More sharing options...
landavia Posted January 23, 2009 Share Posted January 23, 2009 please read text tag u type <input type="text" width="30" name="userdate" />< and read textarea <textarea rows="4" cols="100" id="q1" /></textarea> what the diferent betwen 2? BLOCK this one have name but not the other one and "name" was not include in textarea^^ Quote Link to comment https://forums.phpfreaks.com/topic/142044-textarea-help-please/#findComment-743907 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.