I'm experimenting with forms and I can't tell why the cod below wont echo out the supposed result. Why am doing wrong and how do I get it to echo out user input.
<?php
//way to tell if the form has been submitted (If form not submitted, display form again.)
if (!isset($_POST['submit'])){
?>
<form method="post" action="" />
<input type="text" name="city" />
<input type="submit">
</form>
<?php
//Process input
}
else
{
// Retrieve information from form submission.
$username = $_POST['city'];
echo "Your name is $username.";
}
?>