- PHP

How to get data from Textarea in PHP

You can get data from the textarea same as from the normal inputs. Just set its name parameter and refer to it with $_POST[”] or $_GET[”] depending on the form method.

<textarea name="myTextarea"></textarea>

Example:

<form method="POST" action="">
    <textarea name="myTextarea"></textarea>
    <input type="submit">
</form>

<?php

if(isset($_POST['myTextarea'])) {
    echo 'Result: ' . $_POST['myTextarea'];
}

?>