Learn about...
Connection details have been emailed to you.
In lab, I will demonstrate how to use WinSCP to connect to our remote server.
Here are the server details:
part1.html
in your lab3
folderpart1.php
in your lab3
folderlab3
folder to your remote serverusername.siencs.com
or
username.breimer.net
to test your scripts.
HTML has elements for building forms to create user interfaces.
When a form is submitted, the browser can initiate an HTTP request based on the form's action
attribute, which can specify the name or URL of a PHP server-side script.
The values of form elements are passed to the server as part of the HTTP requests.
PHP scripts can access these values using special global variables called
$_GET
and $_POST
.
Show your instructor part1.html
working on the web server.
part1.html
by replacing the text box for entering the number of nights with a drop down menu, i.e.,
select
and option
elements.
The menu should let the user select the values 1, 2, 3, ..., 9.
See the Mozilla reference for the select tagselect
element the name rooms
.
part1.php
to "get" the number of rooms and store it
as a PHP variable called $rooms
. Then modify the output
of the sentence:
X rooms and Y nights at Z/night is a total cost of SWhere X, Y and Z come from the form and S is computed by the PHP script.
strong
tag.strong
tag so the color is red.part1.html
and part1.php
username.siencs.com
or
username.breimer.net
to test your scripts.$_GET
$
Show your instructor part1.html
working on the web server.
part1.html
by adding two labels and two radio buttons so the user can select either a smoking or non-smoking room.
The two radio buttons should both have the name "type" with the values "smoking" and "non-smoking" respectively.
See the Mozilla reference for radio buttonspart1.php
by using the $_POST
variable instead
of the $_GET
variable to fetch the form data.part1.php
to fetch the room type as a PHP variable called $type
. Then modify the output
of the sentence:
X T rooms and Y nights at Z/night is a total cost of SWhere T is the value of the room type, i.e., "smoking" or "nonsmoking" e.g., 3 smoking rooms and 4 nights at 100/night is a total cost of 1200.
part1.html
and part1.php
username.siencs.com
or
username.breimer.net
to test your scripts.Key Concept: Receiving data via the GET method is very useful because you can see the submitted values in the URL which is helpful for debugging. In a URL, a question mark ?
is used to define a
query string. The query string consists of name=value
pairs. Each pair is
delimited with a &
. Passing data via the POST is more common because it hides the submitted values and it allows large amounts of data to be passed. The size of the URL is limited so you cannot pass large amounts of data using GET.
Show your instructor the part1.html
form working on the web server.
Create a zip file of your lab3
folder called lab3.zip
and submit the file in Blackboard. The zip file should contain three files:
part1.html
and part1.php
.
If applicable, in the comment area of Blackboard put your partner's name.
The deliverable must be submitted in Blackboard by midnight on the day before your next scheduled lab meeting. If you wish to work alone, you can submit the deliverable yourself. However, you are encouraged to work with your partner and you can submit together. When submitting as a lab pair, be sure to include your partner's name in the comment area when you submit via Blackboard.
Outside of lab, you are only permitted to work with your lab partner. Do not share your work with any other student.