CIS 214 PHP and MySQL
Chapter 4 Homework Date due: 02/27/2012
Your name: _______________________________________________
1. |
Validation, which is the process of checking to make sure form _______________ is OK before doing anything with it. |
Answer: |
2. |
Sending the _______________ should completely hinge on the data validation. |
Answer: |
3. |
Languages like _______________ can do clientside validation. |
Answer: |
4. |
PHP_______________ statement lets your code make decisions based on whether or not something is true. |
Answer: |
5. |
The heart of the if statement is its test _______________, which is always interpreted as either true or false. |
Answer: |
6. |
It’s quite common to use a _______________ as a test condition, which typically involves comparing a variable to some value. |
Answer: |
7. |
Equality comparisons aren’t just for variables and strings. You can compare variables to numbers, variables to variables, and even perform _______________. |
Answer: |
8. |
There are two ways to check if things are not _______________: <> and!=. |
Answer: |
9. |
The_______________ than sign (>) checks to see if the value on the left is greater than the value on the right. |
Answer: |
10. |
The_______________ than sign (<) compares the value on the left to the value on the right. |
Answer: |
11. |
Greater than or equal to (>=) is like greater than (>) except it also results in true if the two values are ______________. |
Answer: |
12. |
Less than or equal to (<=) is _______________ to less than, except it’s also true if the values are equal. |
Answer: |
13. |
Yes, you can compare strings in _______________ test conditions. They work based on the alphabet, with a being considered smaller than (less than) z. |
Answer: |
14. |
Is a test condition the same thing we used to control while loops in Chapter 3? |
Answer: |
15. |
The _______________ function tests to see if a variable exists, |
Answer: |
16. |
Theempty() function takes things one step further and determines whether a variable contains an _______________ value. |
Answer: |
17. |
Isset() doesn’t show you the difference between a blank form field and a filled out one. The _______________ function checks to see if a variable is actually empty, which is what we need for form validation. |
Answer: |
18. |
The _______________ function is extremely valuable when you need to know if a piece of data exists. |
Answer: |
19. |
The _______________ operator (!) turns true into false, or false into true. |
Answer: |
20. |
PHP logic _______________ make it possible to structure more elegant if statements. |
Answer: |
21. |
Logical _______________ is coded as &&, while logical OR is coded as ||. |
Answer: |
22. |
The AND (&&) and OR (||) logical operators make it possible to structure much more powerful _______________ conditions that would otherwise require additional, often messy, if statements. |
Answer: |
23. |
Does it matter what order you put two conditions joined by && or || in an if statement? |
Answer: |
24. |
The _______________ clause starts right after the closing curly brace for the if statement. |
Answer: |
25. |
Just like the action code in an if, the code in an _______________ is enclosed in curly braces. |
Answer: |
26. |
The else clause _______________ code when an if test condition is false. |
Answer: |
27. |
It's always a good idea to simplify code whenever possible, especially _______________ code that gets too deep. |
Answer: |
28. |
You can close and open blocks of PHP code to output chunks of _______________ code in a PHP script. |
Answer: |
29. |
Use a _______________ variable known as a flag to keep track of whether or not we need to output the form. |
Answer: |
30. |
Setting _______________ to false initially means the form won't get shown unless there is a validation problem that causes its value to change. |
Answer: |
31. |
By making _______________ code dependent on an IF statement, we avoid duplicate code in our script. |
Answer: |
32. |
An HTML form that is part of the PHP script that processes it is known as _______________. |
Answer: |
33. |
Sticky _______________ remember the data the user has already correctly entered. |
Answer: |
34. |
The _______________ attribute of the <form> tag connects a form to the script that processes it. |
Answer: |
35. |
$_SERVER[‘PHP_SELF’] stores away the _______________ of the current script. |
Answer: |
36. |
The $_POST _______________ allows us to check and see if a form has been submitted. |
Answer: |
37. |
For a text area input field, we echo the sticky data in between the <textarea> and </textarea> _______________ instead of using the value attribute. |
Answer: |
38. |
It’s incredibly important for each row in a table to be _______________ identifiable, meaning that you can specifically access one row (and only that row!). |
Answer: |
39. |
We can use it to create a new column without having to drop the table and destroy its data. |
Answer: |
40. |
A _______________ key is a column in your table that makes each row unique. |
Answer: |
41. |
The_______________ loop is a special kind of loop designed specifically for cycling through values stored in an array. |
Answer: |
42. |
The _______________ loop takes an array and loops through each element in the array without the need for a test condition or loop counter. |
Answer |
Total Correct: _______________________
Percent: _______________________
Grade: _______________________