PHP Form Textarea

In this chapter you will learn:

  1. What is Form Textarea
  2. Example - 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>/*from j a  va  2  s. co m*/
<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>";
?>

Next chapter...

What you will learn in the next chapter:

  1. What is a checkbox
  2. Example - PHP Form CheckBox
Home » PHP Tutorial » PHP Form
PHP HTML Forms
PHP GET and POST
PHP Form Elements
PHP Form TextField
PHP Form Password Field
PHP Form Textarea
PHP Form CheckBox
PHP Form Select
PHP Form RadioButton
PHP Form Submit
PHP Form Reset
PHP Form Push Button
PHP Form Image
PHP Form Hidden Field
PHP Split Form Across Pages
PHP Form Validation
PHP Form File Upload
PHP Form Demo
PHP Form Empty Fields
PHP Form Multi-Value Fields
PHP Redirect after a Form Submission