Jump to content

Text area use in forms with php


lauralee

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 comment
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 comment
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 comment
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 comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...