PHP Form Textarea

Description

A text area field is similar to a text input field, but it allows the user to enter multiple lines of text.

Unlike most other controls, an initial value is placed between the <textarea> ... </textarea> tags, rather than in a value attribute.

A textarea element must include attributes for the height of the control in rows (rows) and the width of the control in columns (cols):


<label for="textAreaField">A text area field</label> 
<textarea name="textAreaField" id="textAreaField" rows="4"  cols="50"></textarea> 

Example

Name the following script as index.htm. It has a text area and a submit button.


<html>/*  w  ww  .j a va  2 s .c om*/
<body>
   <form action="index.php" method="get">
      <textarea name="address" rows="5" cols="40"></textarea>
      <input type="submit" value="hit it!" />
    </form>
</body>
</html>

Name the following script as index.php. It reads the value from the textarea from the form above.


<?php
   print "Your address is: <br/><b>" . $_GET ['address'] . "</b>";
?>




















Home »
  PHP Tutorial »
    Form »




PHP Form
Form Demo