Post text area to php form

A text area can hold an unlimited number of characters, and the text renders in a fixed-width font. Php can accept the textarea data through the global array $_POST in a form post. look at the example below to get a clear picture.

<html>
<head>
<title>A simple HTML form from w3mentor.com</title>
</head>
<body>
<form action="form.php" method="GET">
  <input type="text" name="user">
  <br />
  <textarea name="address" rows="5" cols="40">
  </textarea>
  <br />
  <input type="submit" value="go">
</form>
</body>
</html>

Save as form.php

1
2
3
4
5
6
7
8
9
10
11
12
 
<html>
<head>
<title>Reading textarea from form</title>
</head>
<body>
<?php
print "Welcome <b>$_POST['user']</b><p>\n\n";
print "Your address is:<p>\n\n<b>$_POST['address']</b>";
?>
</body>
</html>
Share Article/Example:
  • DotNetKicks
  • DZone
  • StumbleUpon
  • Print
  • Add to favorites
  • Digg
  • del.icio.us
  • Twitter
  • Facebook
  • LinkedIn
  • Posterous
  • Slashdot

 

 
eXTReMe Tracker