Jump to content

Text area use in forms with php


Recommended Posts

I need to allow a user to edit text on a website, so I fill the form input areas with the fields from the appropriate table. But, when using <input type="textarea", etc. etc., the form simply shows as <input type="text"> Is there a special label that I should be using so that the input area that is populated with data from a database field shows up as an html textarea?

echo '</label><input type="textarea" name="order" value = "' . $row['order'] . '" rows = "5" cols = "50"/><br />';

Link to post
Share on other sites

Textarea tags need to be closed, and no "type" is needed. They also don't take a "value" param:<textarea name="order" rows = "5" cols = "50"/>$row['order']</textarea>

I need to allow a user to edit text on a website, so I fill the form input areas with the fields from the appropriate table. But, when using <input type="textarea", etc. etc., the form simply shows as <input type="text"> Is there a special label that I should be using so that the input area that is populated with data from a database field shows up as an html textarea?
echo '</label><input type="textarea" name="order" value = "' . $row['order'] . '" rows = "5" cols = "50"/><br />';

Link to post
Share on other sites

And yes, you can use the "rows" and "cols" attributes, but I prefer using CSS width/height, because the rows and cols for a textarea will vary depending on the web browser. Using the CSS width and height properties will keep it the same size regardless of the browser.

Link to post
Share on other sites
And yes, you can use the "rows" and "cols" attributes, but I prefer using CSS width/height, because the rows and cols for a textarea will vary depending on the web browser. Using the CSS width and height properties will keep it the same size regardless of the browser.
I use CSS to style them too, but the rows and cols attributes are required. The validator will show an error if you don't have those attributes.
Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...