Installation
- login to one of our lab systems
- Download this zip to your
~/www
directory
- unzip it
- Make sure the permissions are set properly
- Go to http://cslinux.utm.utoronto.ca/~UTORID/phpIntro to find this file as well as the rest of this package.
Exercises
- 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?
- 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.
- Go to addit01.html, play with it a bit.
- Take a look at the source for addit01.html as well as the source
you see after submitting the form.
- Where does addit01.html submit to?
- Take a look at addit01.php and explain how it works.
- What happens when you place the following URL in your browser
http://cslinux.utm.utoronto.ca/~UTORID/phpIntro/addit01.php?arg1=17&arg2=43
- Try using addit01.php to add different numbers.
- How does addit01.php work? $_REQUEST[ ] is a special dictionary,
you can find form variables and values there.
- Take a close look at addit01.html, connect its form with the variables
in addit01.php
- Explain what happens when you request addit01.html, then fill out the form and then submit it.
- Go to addit02.php and explain how this single page application works.
- Go to https://secure.php.net/manual/en/ and take a look at reserved variables,
https://secure.php.net/manual/en/reserved.variables.php
- Run addit03.php a few times, see how this differs fromaddit02.php
- Lookup isset, what does it do?
- Explain how addit03.php works, so that you only see an answer if you press the right button.
- What happens each time you click on the submit button? Answer: The form submits
back to the server, where it is processed.
- 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
- Run addit04.php a few times, take a look at the source code on the server. How does this work?