Jump to content

Problem returning text to a textarea form element


geroid

Recommended Posts

Hi

Can anyone help me with this problem. I'm carrying out some form validation. If the user omits some info, I send them back the form filled up with the original data they supplied telling them to please complete the form. I've done this for input boxes filling the input boxes with the contents of session variables that hold the user form data. That works perfectly well and when the form is thrown back at the user their original data is there so they don't have to fill it up again - just what they omitted.

 

However, for this textarea tag on the form, the data is not displaying when the form is returned. I know for sure that the session variable with this data does actually contain it cos I've echoed it to be sure. I've supplied the particular code below. Can you tell me why the data is not being displayed?

<TD><textarea cols="40" rows="12" wrap="hard" name="content"  value="<?echo $_SESSION['content'] ?>">
      </textarea></TD></TR></TABLE><BR><BR>

<textarea> did not have a value="" options like input does.

 

http://www.w3.org/TR/html401/interact/forms.html#h-17.7

 

You need to put the text inside the tag like this :

 

<textarea>
this text will appear inside the box
</textarea>

 

Instead of a input like this :

 

<input type="text" value="this text will appear inside the form">

Archived

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

×
×
  • Create New...

Important Information

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.