Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.
Well done!
You have completed Working with $_GET and $_POST in PHP!
Instruction
Using $_GET variables in a Function
In this section we will replicate the same functionality as we did in the previous example by using a function. Fork the Treehouse workspace and preview the workspace to view the code below.
Fork Workspace
<?php
function greeting() {
$name = $_GET['name'];
echo "Hello, " . $name;
}
greeting();
?>
NOTE: The code below will display a Notice: Undefined index... and Hello, beca...