Main ideas about PHP:
- files are placed in htdocs
- files have extension .php
- ln -s one.php one.phps is used to post the source code
- data comes in the same CGI format: name1=value1&name2=value2
- PHP automatically creates $name1, $name2 with values "value1", "value2"
- code is marked with
<? ... ?> tags (scriptlets)
-
<?=...?> is used to print the value of an expression
- keep state just like before, in hidden fields
- the template developed for homework two remains unchanged
- basic PHP code syntax is more similar to Perl, but also a bit to Python
To keep state on the server side:
- the code starts with
<? session_start(); ?>
- replace hidden fields storing state data with calls to
session_register("...")
- each such call creates a variable
$name directly linked to the session state variable
In class we will work examples to clarify these principles.
Code developed will be printed here after class.