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
jim
Jul 12 '06 #1
Share this Question
Share on Google+
2 Replies


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

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

ronverdonk
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.

[PHP]<?php
// 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.....
}
[/PHP]
Ronald :cool:
Jul 20 '06 #3

Post your reply

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