| Learning php |
||
| What Php can do
|
|
|
| basic syntax |
PHP used for server-side scripting is typically embedded in XHTML code but the
file is named with a php extension. The extension php on the filename signals that the PHP interpreter should be executed to process the file before it is sent to the end-user. The interpreter only executes the statements between the beginning php tag <?php and the ending php tag ?>. The rest of the text(XHTML) in the file is simply written as-is to the file that will be sent to the end-user. PHP is case-sensitive. PHP statements end with a semi-colon ; PHP uses the curly braces { } to block statements. Basic embedded php syntax:
|
|
| Creating your first php script |
|
|
| variables |
Variables are typically not typed but the data type is determined at runtime. Variable names:
PHP identifier:
|
|
| Simple selection statement |
if
if-else
if-elseif
|
|
| Creating your first script to process a form |
You will need the pet form created in the form lecture: petform Make sure the petform submit action sends it to your petform_ex1.php script
|
|
| loops |
while
do-while
for
foreach - used only for arrays as a way to iterate through the array
|
|
| processing a checkbox |
|
|
| the php example from class: click here |