Sup guys (and girls).So iv'e dabbled in a little bit of PHP lately and decided to try this out. This isn't homework or an assignment, its just experimentation . However this has answered some questions and raised a few as well.
I would like to know if there are any benefits to using separate HTML code to get form data or is this the best way to go about doing that, and if there are other uses for outputting html in PHP . . . thanks in advance . . .
Code:
<?php
echo 'What is your name?<p>';
echo "<form action=\"huh.php\" method=\"POST\">";
echo "<input type=\"text\" name=\"yourname\">";
echo "<input type=\"submit\" name=\"submit\">";
echo "</form>";
if (isset($_POST["yourname"])&&!empty($_POST["yourname"])){
$name = $_POST["yourname"];
echo 'your name is '.$name.'. Thank you for telling me';
}
?>
Comment