There is such a form, but it does not work, what's the problem?

<?php if(isset($_POST['firstname']) && isset($_POST['comment'])) { $name = htmlentities($_POST['firstname']); $secondname = htmlentities($_POST['secondname']); $comment = htmlentities($_POST['text']); $output =" <html> <head> <title>АнкСтныС Π΄Π°Π½Π½Ρ‹Π΅</title> </head> <style> body{ background: #C5D2DB; font-family: Verdana, Geneva, sans-serif; font-size: 14px; font-weight: bold; text-align: center; } ul{ list-style-type: none; text-align: center; } container{ padding-top: 20px; } </style> <body> <container> Вас Π·ΠΎΠ²ΡƒΡ‚: $name<br /> Π’Π°ΡˆΠ° фамилия: $secondname<br /> Π’Π°Ρˆ ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠΉ: $comment<br /> </container></body></html>"; echo $output; } else { echo "Π’Π²Π΅Π΄Π΅Π½Π½Ρ‹Π΅ Π΄Π°Π½Π½Ρ‹Π΅ Π½Π΅ΠΊΠΎΡ€Ρ€Π΅ΠΊΡ‚Π½Ρ‹"; } ?> 
 <!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8"> <title>Anketa</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container"> <h2>АнкСта пСрвокурсника</h2> <form action="input.php" method="POST"> <p>Π’Π²Π΅Π΄ΠΈΡ‚Π΅ имя:<br> <input type="text" name="firstname" /></p> <p>Π’Π²Π΅Π΄ΠΈΡ‚Π΅ Ρ„Π°ΠΌΠΈΠ»ΠΈΡŽ:<br> <input type="text" name="secondname" /></p> <p>ΠšΡ€Π°Ρ‚ΠΊΠΈΠΉ ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠΉ: <br> <textarea name="comment" maxlength="200"></textarea></p> <input type="submit" value="ΠžΡ‚ΠΏΡ€Π°Π²ΠΈΡ‚ΡŒ"> </form> </div> </body> </html> 

  • How exactly does not work? - Enikeyschik
  • A comment in one file has the name comment, and in another a text. - Enikeyschik
  • Writes the error "Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0" - Matc

1 answer 1

I do not know everything works ... fixed the name in textarea

 <?php if(isset($_POST['submit'])) { $name = htmlentities($_POST['firstname']); $secondname = htmlentities($_POST['secondname']); $comment = $_POST['comment']; $output =" <html> <head> <title>АнкСтныС Π΄Π°Π½Π½Ρ‹Π΅</title> </head> <style> body{ background: #C5D2DB; font-family: Verdana, Geneva, sans-serif; font-size: 14px; font-weight: bold; text-align: center; } ul{ list-style-type: none; text-align: center; } container{ padding-top: 20px; } </style> <body> <container> Вас Π·ΠΎΠ²ΡƒΡ‚: $name<br /> Π’Π°ΡˆΠ° фамилия: $secondname<br /> Π’Π°Ρˆ ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠΉ: $comment<br /> </container></body></html>"; echo $output; } else { echo "Π’Π²Π΅Π΄Π΅Π½Π½Ρ‹Π΅ Π΄Π°Π½Π½Ρ‹Π΅ Π½Π΅ΠΊΠΎΡ€Ρ€Π΅ΠΊΡ‚Π½Ρ‹"; } ?> <!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8"> <title>Anketa</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container"> <h2>АнкСта пСрвокурсника</h2> <form action="10.php" method="POST"> <p>Π’Π²Π΅Π΄ΠΈΡ‚Π΅ имя:<br> <input type="text" name="firstname" /></p> <p>Π’Π²Π΅Π΄ΠΈΡ‚Π΅ Ρ„Π°ΠΌΠΈΠ»ΠΈΡŽ:<br> <input type="text" name="secondname" /></p> <p>ΠšΡ€Π°Ρ‚ΠΊΠΈΠΉ ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠΉ: <br> <textarea name="comment" maxlength="200"></textarea></p> <input type="submit" value="ΠžΡ‚ΠΏΡ€Π°Π²ΠΈΡ‚ΡŒ" name="submit"> </form> </div> </body> </html>