CIS 148 Introduction to Database Driven Web Sites Exercise Set 4A

advertisement
CIS 148 Introduction to Database Driven Web Sites
Student Name Answer Key
Exercise Set 4A
Section ___ Date _______
PHP Forms
(1)
What is performed by the following PHP code?
<html>
<body>
<form action = "welcome.php" method = "post">
Name: <input type = "text" name = "name" />
Email: <input type = "text" name = "address" />
<input type = "submit" />
</form>
</body>
</html> HTML file is used to send name / address to a PHP file.
(2)
What is performed by the following PHP code?
<html>
<body>
Welcome <?php echo $_POST["name"]; ?>.<br />
Your address is: <?php echo $_POST["address"]; ?>
</body>
</html> PHP file is used to display name / address in a PHP file.
(3)
Using client scripts with JavaScript, user input should be validated on the browser
whenever possible.
(a)
(4)
(b)
False
True
(b)
False
True
(b)
False
True
(b)
False
True
(b)
False
When using the $_POST variable all variable names and values are displayed in the
URL .
(a)
(11)
True
Information sent from a form with the GET method is visible to everyone and is
displayed in the browser's address bar.
(a)
(10)
False
The $_GET variable is an array of variable names and values sent by the HTTP GET
method.
(a)
(9)
(b)
The $_GET variable is used to collect values from a form with method = "post" .
(a)
(8)
True
A good way to validate a form on the server is to post the form to another Web page.
(a)
(7)
False
Server validation should be considered if the user input will be inserted into a database.
(a)
(6)
(b)
Browser validation ( client - side ) helps reduce the server load.
(a)
(5)
True
True
(b)
False
The PHP $_REQUEST variable can be used to get the result from form data sent with
both the GET and POST methods.
(a)
True
© Copyright 2011 by P.E.P.
(b)
False
1
CIS 148 Introduction to Database Driven Web Sites
Student Name Answer Key
(12)
Section ___ Date _______
Information sent from a form with the POST method is invisible to others and does not
have any limits on the amount of information to send.
(a)
(13)
Exercise Set 4A
True
(b)
False
When $_POST is used and when the user clicks the " Submit " button, the URL will not
contain any form data, and will look something like this:
http://www.fye.com/welcome.php
(a)
(14)
(b)
False
When $_POST is used, __________ .
(a)
(b)
(c)
(d)
(15)
True
variables sent with HTTP POST are not shown in the URL
variables do not have a length limit
All of the above
None of the above
Which method should be used when sending passwords or other sensitive information via
a form object?
(a)
(b)
(c)
(d)
$_GET
$_POST
All of the above
None of the above
(16)
The $_POST variable is an array of variable names and values sent by the HTTP
POST method.
(17)
The $_GET variable is an array of variable names and values sent by the HTTP GET
method.
(18)
The $_GET variable is used to collect values from a form with method = "get" .
(19)
The $_POST variable is used to collect values from a form with method = "post" .
(20)
If the following appears in the URL , most likely the $_GET variable is used to collect
values from a form with method = "get" .
http://www.fye.com/welcome.php?name=James&age=33
http://www.zipskinny.com/index.php?zip=60016
© Copyright 2011 by P.E.P.
2
Download