Jump to content
xisto Community
Sign in to follow this  
jlhaslip

<textarea> Tag Is Not Accepting Php Variable for display, although Input tag does accept it

Recommended Posts

I have a single page template which has a Form on it. Logic is to check for a valid Querystring and place the variables accepted from a form back into the form and re-display this form with error or acceptance messages. I'm sure everyone here has done this a million times.

The Form accepts data from a user for First name, Last name, email address, and message-body named 'note_wide' then re-displays the values into the Form, but for some reason, I can't get the value to display into a Textarea.
Sample of the php code is as follows: first the good one:

<input type="blah" etc... value=" <?php echo &_POST['email'] ?>" />

The one that doesn't work is the same use of the php string being echoed except using the Textarea tag instead: example:
<textarea type="blah" etc... value=" <?php echo &_POST['note_wide'] ?>" />

The etc includes name, class and other stuff which all appears to work for the 'good' Input tag. Is it only because the php string is being echoed to a <textarea> that this is a problem???

Any ideas about how to fix it?

Share this post


Link to post
Share on other sites

The textarea tag does not use a value attribute. Instead you should place you contents between a start and end tag. Like this:

<textarea type="blah" etc... value="><?php echo &_POST['note_wide'] ?></textarea>

Share this post


Link to post
Share on other sites

Bingo, Thanks for that. Sometimes after staring at the problem for too long, you can't see the simple things. Works excellent now. Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.