TEXT AREA content retaining

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
syamswaroop
Forum Newbie
Posts: 19
Joined: Fri May 01, 2009 1:31 am

TEXT AREA content retaining

Post by syamswaroop »

can anyone help how i can retain a text area content.
bcoz for any reason if the page fails the validation , my requirement is to retain the content .
Please help very urgent.

regards
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: TEXT AREA content retaining

Post by jayshields »

Something like this:

Code: Select all

echo '<textarea name="stuff">';
if(isset($_POST['stuff'])) echo $_POST['stuff']; //Use $_GET if you're using the GET method instead of POST (not a great idea with textareas)
echo '</textarea>';
Remember that with sticky forms like this you should clear the $_POST array after you've dealt with it's contents on a successful submission.
Post Reply