Last active
July 4, 2016 15:45
-
-
Save websmith/d61cb17e72ee3a7a20188470fee6d34e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_POST['submit'])) { | |
// Save the values of all of our form data as variables | |
$username = $_POST['username']; | |
$email = $_POST['email']; | |
$message = $_POST['message']; | |
//Validate $username | |
if(!isset($username) || empty($username)) { | |
echo "<p>Please fill out your user name.</p>"; | |
} | |
else { | |
echo "<p>Username: ".$username."</p>"; | |
} | |
//Validate $email | |
if(!isset($email) || empty($email)) { | |
echo "<p>Please fill out your email.</p>"; | |
} | |
else { | |
echo "<p>Email: ".$email."</p>"; | |
} | |
//Validate $message | |
if(!isset($message) || empty($message)) { | |
echo "<p>Please fill out the message field.</p>"; | |
} | |
else { | |
echo "<p>Message: ".$message."</p>"; | |
} | |
} else { | |
echo "<p>The form was not submitted!</p>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment