How to use PHP & Multiple textarea This tutorial how to using PHP read a variable from input Multiple textarea
ShotDev Focus:
- Using PHP & Multiple textarea
Example
php_multiple_textarea1.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form action="php_multiple_textarea2.php" method="post" name="form1"> <textarea name="txtDescription[]" cols="20" rows="3"></textarea><br> <textarea name="txtDescription[]" cols="20" rows="3"></textarea><br> <textarea name="txtDescription[]" cols="20" rows="3"></textarea><br> <input name="btnSubmit" type="submit" value="Submit"> </form> </body> </html>
php_multiple_textarea2.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <? for($i=0;$i<count($_POST["txtDescription"]);$i++) { echo "txtDescription $i = <br>".nl2br($_POST["txtDescription"][$i])."<hr>"; } ?> </body> </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_multiple_textarea1.php
Screenshot