Created
October 8, 2016 15:29
-
-
Save zelon88/0f6617b755291752122c65c16a2ccd3e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<form action="TeachingKids.php" method="post"> | |
<p>Name: <input type='text' id='name' name='name' value=''> | |
<input type="submit"></p> | |
</form> | |
<p> | |
<?php | |
// Teaching my kids how to code. | |
$name = $_POST['name']; | |
$awesomeboys = array('boy', 'dad'); | |
$coolgirls = array('girl', 'mom'); | |
if (in_array($name, $awesomeboys)) { | |
echo 'You are an awesome boy!'; } | |
if (in_array($name, $coolgirls)) { | |
echo 'You are a cool girl!'; } | |
if (!in_array($name, $awesomeboys) && !in_array($name, $coolgirls)) { | |
echo 'I don\'t know you '.$name.'!'; } | |
?> | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment