Professional Documents
Culture Documents
Chapter 3 Web Form
Chapter 3 Web Form
CHAPTER 3:
Web Form
Topics covered:-
• Server-Side/Client-Side Web Scripting
• Superglobals Variables
• Web Form
• Validation
• Including Multiple Files
• Sticky Forms
Learning Outcomes
At the end of this chapter, you should be able to
• Explain what server-side scripting is.
• Write scripts accessing to superglobal variables
• Create and process Web forms
• Build forms with multiple included files
• Create sticky forms
PHP (1)
• PHP is used generally for form handling, file processing,
and database access.
• PHP code is placed in the body of an HTML document.
<!- - example.php
<html>
<head><title> Trivial php example </title>
</head>
<body>
<?php
echo "The current time is ".date('F j, Y');
?>
</body>
</html>
AMIT 2043 Web Systems and Technologies
Chapter 3 Web Form Slide 6
PHP (2)
● A web browser requests a document (indicated by a file
ending .php) from the web server.
● The web server will locate the file on its hard-drive, interpret
(using the PHP interpreter) and execute its contents.
● The result is a dynamically assembled HTML code that is then
sent back to the browser which renders the HTML code into a
web page.
Request
index.php
if (isset($_POST[‘submitted’])) {
// Validate and Handle it.
} else {
// Display it.
}
Or
if (isset($_POST[‘submitted’])) {
// Validate and Handle it.
}
// Display form
calculator.php
AMIT 2043 Web Systems and Technologies
Chapter 3 Web Form Slide 23
multiple-files\homePage.php
eader.html
Calculator.php
footer.html
References
• PHP 6 and MySQL 5 by Ullman, L. Peachpit Press
• PHP Programming with MySQL Second Edition by
Gosselin, D., Kokoska, D. & Easterbrooks, R. Course
Technology