I'm creating a script on my website to echo the contents of an entire form. My html code looks like this:
<form action ="forma.php" method ="POST" name="FORM-TXT">
First name:<br>
<input type="text" name="firstname"><br>
Last name:<br>
<input type="text" name="lastname">
<input type="submit" name="submitsave" value ="Submit">
</form>
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
//use the html Name element to attach html to php scripts
//V-----------------=|txt file codes|=-----------------V
$text = $_POST["FORM-TXT"];
echo $text;
?>
When I run the form, this error is thrown:
Notice: Undefined index: FORM-TXT in /homepages/31/d585123241/htdocs/mail/forma.php on line 7
How can I make it so the entire form echos, but no specific elements are referenced, only the form.