Form input text box that doesn't clear?

Form input text box that doesn’t clear?

Hi all

Is it possible to have input text area that doesn’t clear when a submit button is pressed.
In this example here - if I enter text in the box then click the submit button the text box clears - I want to keep the text in the text box.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

<html xmlns="" xml:lang="en" lang="en">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>


  <form action="" method="" >
    <input type="text" name="text" />
    <input type="submit" value="Set &rarr;">


You are submitting the form to the same web page it is in.

So one option is to use the form’s GET or POST value of the input text area to set the default value for the text area when the page reloads after you have submitted it.

How would I do that ?

Are you using PHP to process your form? If so, you can make your inputs “sticky”, meaning that what’s entered into a field stays there after submission.

An example would be as follows:

<textarea name="comments">
    <?php if (isset($_POST["comments"])) {echo $comments;} ?>

This thread probably should be moved to the PHP forum.