How to get data from a text area

The HTML for a textarea

      <textarea id="comment" name="comment" rows="4" cols="50">>Welcome to PHP and MySQL!</textarea>
      

The URL when using the GET method

When the user includes spaces in the text area

       process_data.php?comment=Welcome+to+PHP+and+MySQL!
      

When the user presses the Enter or Return key to start a new line

      process_data.php?comment=Welcome+to%0D%0APHP+and+MySQL!
      

When the user doesn’t enter any text

      process_data.php?comment=
      

The PHP to get the data from the text area

      <?php
      $comment = filter_input(INPUT_POST, 'comment');
      ?>
      

Back