Form Example

Created Friday 21 April 2017

Remember, while it is possible to do this in one file, it might be easier to do it as two as a beginner. The form need not have php (though, eventually it likely will)

myform.html:

<html><body>
<h4>Make a new being! </h4>
<form action="myprocess.php" method="post"> 

Please enter a name <input name="being" type="text"/>
<br>
And then, tell me where they are from.
<select name="homeworld">
	<option>Earth</option>
	<option>Asgard</option>
	<option>Somewhere Else</option>
</select>

<br>
<input type="submit" value="LETS GO" />
</form>

</body></html>


myprocess.html

<html>
<body>

Hey we're here!

<?php

// echo "debug!<br>";
// print_r($_POST);
// echo "debug done<br>";

$being = $_POST['being'];
$homeworld = $_POST['homeworld'];

echo " BEHOLD. Your new being shall be called <h1> $being !</h1>";
echo "<br>";
echo "This being hails from $homeworld!";

?>


</body></html>


Backlinks: FSU Courses:LIS5364