You will be able to use notes and your Virtual Machine to test and verify code
You will be given two hours of class time to answer the questions and will turn in the results on BlackBoard
Examples and things to consider
Be able to describe the different kinds of variables being used. Are they scaler? What are their data types?
e1sample1.php
1 2 3 4 5 6 7 8 9101112131415
<html> <body><?php// Code sample 1$var_a='Fred';$var_b="Barney";$var_c=123;$var_d=456;print'Variable a is $var_a';echo"<br />";echo"Variable b is $var_b<br/>";?> </body></html>
How does this html relate to the PHP script below it? What are the variables the PHP script should expect to recieve.
e1sample2.html
1 2 3 4 5 6 7 8 9101112131415161718
<html><head><title>Sample2 HTML Form</title></head><bodybgcolor="lightblue"><formaction="e1sample2.php"method="POST"><p>
please enter your name: <br/><inputtype="text"size=30name="userName"/><br/>
please enter your phone number: <br/><inputtype="text"size=30name="userPhone"/><br/><inputtype=submitvalue="submit"/></p></form></body></html>
Be able to describe each line of the following PHP script. What is an issue you may have with using extract over specifying which form elements to get data from?
NOTE: Look up items in the PHP Manual if you're not sure what they are or how they work!
e1sample2.php
123456
<?php// This is the PHP script that processes the form: simple.htmlextract($_REQUEST);print'Your name is: '.$userName.'<br />';print"Your phone number is: $userPhone<br />";?>
Be able to understand the types of loops and how they work.
Be able to describe the HTML form and it’s PHP counter part, what variables are being passed, etc.
e1sample6.html
1 2 3 4 5 6 7 8 9101112131415161718192021
<html><head><title>Sample 6</title></head><body><formaction="e1sample8.php"method="POST"><p>
Enter your name:<br/><inputtype="text"size=50name="userName"/></p><p>
Enter your phone:<br/><inputtype="text"size=50name="userPhone"/></p><p>
Enter your email address:<br/><inputtype="text"size=50name="userEmail"/></p><p><inputtype="hidden"name="formName"value="sample8"/><inputtype="hidden"name="createDate"value="March 2008"/><inputtype=submitname="send"value="submit"/><inputtype=resetvalue="clear"/></form></body></html>
<html> <head><title>Sample 6</title></head> <body><?phpif((!empty($_GET))||(!isset($_POST['formName']))||($_POST['formName']!='sample8')){die("Bad input data source<br />");}$name=$_POST['userName'];$phone=$_POST['userPhone'];$email=$_POST['userEmail'];?> <div align="center"> <table> <tr><td> Welcome to PHP, <em><?phpecho$name;?>.</em> </td></tr><tr><td> Can I call you at <em><?phpecho$phone;?>? </em> </td></tr><tr><td> Is it OK to send you email at <em><?phpecho$email;?>?</em> </td></tr> </table> </div> </body></html>
Understand what each of the mysql commands is doing and what output it might produce.