In the example we assigned a value to $firstName and $lastName using assignment statements. In most case the values for these variables would come from some external source such as a database, a form, or a file. We will look at each of these external sources later in the book.
Another way to give a value to a variable is by including it in the URL. The code shown below has been uploaded to the server.
<?php echo "Hello $firstName $lastName"; ?>
Click this link and notice how the value of the variable is added to the URL:
hello4.php?firstName=John&lastName=Doe
When you add values to the URL the first variable is after a question mark. Additional value follow an ampersand: &
Look at the source in hello4.html?firstName=John&lastName=Doe
Notice that in the html example you can view the source and see the PHP code, but the PHP code is not executed. In fact, you see absolutely nothing in the browser.
Experiment: