Jump to content

Need to pass additional text with $_Post var via html textarea


Go to solution Solved by kicken,

Recommended Posts

I have a web application that has about 700 rows, each rows has a html textarea for the user to add personal notes. I would like to pass text of some sort along with what the user typed typed into the textarea box.  I want it to be hidden from the user. Any ideas? Any help would be appreciated, I've been stuck on this one for awhile.

 

Thanks

  • Solution

Just stick a hidden input along with the textarea and have some method of associating the two, such as the database row's ID number.

 

<textarea name="textarea[<?php echo $databaseId; ?>]"></textarea>
<input type="hidden" name="hidden[<?php echo $databaseId; ?>]" value="whatever you want">
When the user submits you'll have two arrays as input, one containing the textarea content and one containing the hidden input's content. The arrays can be matched up with the database row's ID number.

Thank you very much, that solved my problem. I never thought to "textarea[<?php echo $databaseId; ?>]" This makes my textarea identifiable because I know where in the array it will be stored. Thanks again.

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.