PHP HTML TextArea
From w3cyberlearnings
Contents |
PHP Works with HTML Textarea
HTML Textarea tag uses for multiple line text input.
Syntax Textarea
<textarea name="mytest" rows="40" cols="40">My Default Text Area</textarea>
Example 1
<?php if ($_POST) { print_r($_POST); } ?> <html> <head> <title>Textarea</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <i>Information</i><br/> <textarea name="description" rows="5" cols="40"></textarea><br/> <input type="submit"/> </form> </body> </html>
Output
Example 2
<?php $msg = ""; if (!empty($_POST['SAVE'])) { $msg .= 'Name: ' . $_POST['NAME'] . '<br/>'; $msg .= 'Description: ' . $_POST['DESCRIPTION'] . '<br/>'; } ?> <html> <head> <title>Textarea form</title> </head> <body> <?php echo $msg; ?> <hr/> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <table> <tr> <td valign="top">Name:</td> <td><input type="text" name="NAME" size="20" maxlength="20"/></td> </tr> <tr> <td valign="top">Description:</td> <td><textarea name="DESCRIPTION" rows="5" cols="40"></textarea></td> </tr> <tr><td colspan="2"><input type="submit" name="SAVE" value="Save It"></td></tr> </table> </form> </body> </html>