PHP with HTML textarea

I am quite new to PHP/HTML all this kind of stuff so sorry if this is an easy question!

Is there a way to read the contents of an HTML text area and pass it into a .php file?

Or even just reading the contents of the text area into a variable would do.



You can achieve that with a basic form:



if ($_POST) // If form was submited...
    $text = $_POST["mytextarea"]; // Get it into a variable
    echo "<h1>$text</h1>"; // Print it!

<form method="post">
    <textarea name="mytextarea"></textarea>
    <input type="submit" value="Go!" />

And this can be done whatever input element you want e.g: inputs type text, password, checkbox, radio or a select or even and fresh HTML5 input type.