By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,905 Members | 2,064 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,905 IT Pros & Developers. It's quick & easy.

textarea lost on validation

P: 1
I am fairly new to this so forgive me if the answer is obvious.
I have written a PHP form script that validates itself by posting back to itself.
I use VALUE=$var for all the input fields so I don't lose the inputted values.
Except the textarea does not seem to support VALUE= and its input is lost if the form input has errors.
What do I need to do to preserve the value of the textbox?
thanx in advance
Jul 12 '06 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,916
remember textarea has an opening and closing tag, the initialisation data goes inbetween them

<textarea><?php echo $TextAreaData; ?></textarea>
Jul 13 '06 #2

Expert 2.5K+
P: 4,258
In order to preserve it you have to give the textarea a name. That name will show up in your $_POST array.

// At the beginning of your program you validate the $_POSTs
if (isset($_POST['that']) {
// checkit
// else display the form again
else {
<textarea name="that"><?php if isset($_POST['that']) echo $_POST['that'] ?></textarea>
other input, submit, etc.....
Ronald :cool:
Jul 20 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.