Installation

  1. login to one of our lab systems
  2. Download this zip to your ~/www directory
  3. unzip it
  4. Make sure the permissions are set properly
  5. Go to http://cslinux.utm.utoronto.ca/~UTORID/phpIntro to find this file as well as the rest of this package.

Exercises

  1. Compare hello.html and hello.php. Look at their source in firefox (ctrl-u). They look similar? Look at their source in your www/phpIntro directory, whats the difference?
  2. Play with addit00.php. Make it so that it finds the result of adding 17 and 43. You will need to modify the file. Take a look at the source in Firefox (ctrl-u). Note that the server is running your addit00.php program on each request.
  3. Go to addit01.html, play with it a bit.
  4. Take a look at the source for addit01.html as well as the source you see after submitting the form.
  5. Where does addit01.html submit to?
  6. Take a look at addit01.php and explain how it works.
  7. What happens when you place the following URL in your browser http://cslinux.utm.utoronto.ca/~UTORID/phpIntro/addit01.php?arg1=17&arg2=43
  8. Try using addit01.php to add different numbers.
  9. How does addit01.php work? $_REQUEST[ ] is a special dictionary, you can find form variables and values there.
  10. Take a close look at addit01.html, connect its form with the variables in addit01.php
  11. Explain what happens when you request addit01.html, then fill out the form and then submit it.
  12. Go to addit02.php and explain how this single page application works.
  13. Go to https://secure.php.net/manual/en/ and take a look at reserved variables, https://secure.php.net/manual/en/reserved.variables.php
  14. Run addit03.php a few times, see how this differs fromaddit02.php
  15. Lookup isset, what does it do?
  16. Explain how addit03.php works, so that you only see an answer if you press the right button.
  17. What happens each time you click on the submit button? Answer: The form submits back to the server, where it is processed.
  18. You can check php errors in /var/log/httpd/ssl_error_log on cslinux.utm.utoronto.ca by grep -e 'USERID' /var/log/httpd/ssl_error_log
  19. Run addit04.php a few times, take a look at the source code on the server. How does this work?