ISSS615 Data Management
Posted el3at2i6
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ISSS615 Data Management相关的知识,希望对你有一定的参考价值。
ISSS615 Data Management
php_LAB1.doc page 1 of 4
SMU Classification: Restricted
PHP Lab 1
Objective:
The objective is to help the students to get hands on writing PHP code. In this lab
exercise, you will create PHP pages based on the requirements specified.
Pre-Requisites:
- WAMP Server is installed and the icon is ‘Green’ in colour.
Submission:
Please submit all your answers in a single lab1.zip file containing the following to eLearn
(online) by the end of the class - Exercise1.php,
- Exercise2.php,
- ex1form.html and ex1result.php
ex3form.html and ex3result.php
ISSS615 Data Management
PHP_LAB1.doc page 2 of 4
SMU Classification: Restricted
PART 1: Write basic PHP syntax codes
Exercise 1
Using php WHILE construct and IF-ELSE statement, write a program to display the count
of lowercase letter \'a\' appearing in the text string "Data Management". Also display total
number of letters that are not \'a\' in the same text string.
Save the file as Exercise1.php
Note: You could make use of the functions strlen and substr for this exercise.
Exercise 2
Write php program to calculate the cumulative sum of numbers from 1 to 10.
Display the result in a table format. Save the file as Exercise2.php
Note: Example of a Table html script that produces a table with 2 rows, a header row and
a content / data row
<html>
<body><tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
</table>
</body>
</html>
ISSS615 Data Management
PHP_LAB1.doc page 3 of 4
SMU Classification: Restricted
PART 2: Write PHP code for processing HTML Form data- Open a text editor, write the following code, and save the file as ex1form.html
<html>
<head><title>A simple form</title></head>
<body>
<form method="post" action="ex1result.php">
Enter your name:
<input type="text" name="fullname" />
<input type="submit" value="send" />
</form>
</body>
</html> - Open a new page on the text editor, write the following code and save the file as
ex1result.php
<html>
<body>
<php
print "Hi $_POST[fullname]. Welcome to PHP lab1 !<br/>";>
</body>
</html> - In Internet Explorer/, enter http://localhost/PHPLab1/ex1form.html in the address bar.
You should see an output as follows - When you enter your name and click on the send button, the following output is
observed.
ISSS615 Data Management
PHP_LAB1.doc page 4 of 4
SMU Classification: Restricted
Exercise 3
Add Gender Identification to the PHP code for processing HTML Form data
Your task is to modify the ex1form.html to include a dropdown box to allow user to select
a gender. Depending on the selected gender, you should print either “Miss” or “Mr”
Hint: - Modify ex1form.html to include another input element, a dropdown box named
gender (Male & Female).
<select name="gender">
<option value="" selected>-- Select One --</option>
<option value="M">Male</option>
<option value="F">Female</option>
</select>
Save the modified file as Exercise3Form.html. - Modify the PHP page (ex1result.php) so that it handles the gender information sent
over by the client and save the modified file as Exercise3Result.php.
If Female is selected, the following output is observed.
If Male is selected in the select dropdown list, the following output is observed.End of PHP Lab 1
WX:codehelp
- Open a text editor, write the following code, and save the file as ex1form.html
以上是关于ISSS615 Data Management的主要内容,如果未能解决你的问题,请参考以下文章
Masm615+notepad++6.8.8搭建汇编开发环境
Codeforces Round #615(Div.3)解题报告