Jump to content

textarea help please


jaydeesmalls

Recommended Posts

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

Link to comment
Share on other sites

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 :P

 

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

Link to comment
Share on other sites

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^^

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.