SlideShare a Scribd company logo
Web forms and Server
Side Scripting
Sawsan Slii Marzouki
Internet Applicatiosn Development
Server Side Scripting
What is a server?
 Many types of server:
File server
FTP server
Web server
Mail server
News server
Dynamic Interactive Web Server
(3-tier architecture(
General Multi-tier Architecture
Web content
 HTML documents are static
 Dynamic content :
 User side programming (JavaScript, CSS, Ajax,
JQuery……)
 Server side programming (PHP, ASP and ASP.Net,
JSP, Python….)
Why Server Side Programming?
 Accessibility :
Any one can reach Internet.
 Manageability :
Does not require distribution of application code
 Security :
Source code is not exposed
 Scalability : (‫)تطور‬
Web-based 3-tier architecture can scale out
History of web dynamic content
 Common Gateway Interface (CGI) was the
first generation approach to providing
dynamic web content (used scripts)
 Numerous second generation alternatives
were invented (FastCGI, mod_Perl, NSAPI,
ISAPI, Java Servlets…)
 Scripting, the third generation
approach
Scripting, the third generation
approach
 Embed simple code in HTML pages
 The HTML pages use the code to decide what
elements to display and what data should be
displayed.
 Classes and/or subroutines can be called to
compute information for inclusion in the web
page.
 This is know as « scripting ».
Scripting languages or compiled
Scripting languages Compiled languages
Server Side Includes (SSI)
Perl
PHP
ASP (VBScript)
Python
C
C++
ASP.Net
Java Servlet
Java Server Pages
Some approaches to Scripting

JavaServer Pages (JSP) by Sun MicroSystems

Hypertext Preprocessor (PHP): open source
 Cold Fusion (CFML) by Macromedia

Active Server Pages (ASP and ASP.Net) by
MicroSoft
Criteria affecting Scripting choice
 Web Server availability
 Knowledge of language
 Scalability and efficiency
 Personal preference
Learn more about JSP,
PHP and ASP.Net
JSP (Java Server Pages(
 Java-based technology that simplifies the
development of dynamic websites
 Designed around the Java Philosophy
 Packaged with J2EE
 It separates presentation aspects from
programming logic contained in the code.
J2EE Technology
 Web container (application server)
 EJB container
 Servlets : JSP pages running in webServers
 JSP: JavaServer Pages
 Apples, XML, JDBC, …….
Servlets and JSP
JSP Basics
 Individual JSP pages are text files stored on the web
server.
 When a page is first required, then JSP Engine uses
the page to generate a Servlet.
 The compiled Servlet is saved and used to serve
additional requests.
 When a page is modified, the appropriate Servlet is
regenerated.
 Precompilation is also possible
A simple JSP code
 New.java.util.Date().ToString(): creates a date
Object and converts it to a String that can be
displayed
What is PHP?
 Open source Server-Side Scripting language
designed specifically for the web.
 Conceived in 1994.
 Supports a wide-range of databases.
 Perl and C like syntax.
 Designed similar to ASP: you embed
commands into your web pages.
What is PHP?
 Commands are preprocessed by Php
processor and appropriate HTML is sent to
the web server.
 Platoform independant
 Easy to learn
 Usually associated to MySQL database (a
relational free DBMS, can run on Unix,
Windows, and Mac OS).
Php Process Flow
Php first example:
ASP.Net
 Based on .Net Framework and the common
language runtime (CLR)
 Compiled language
 MicroSoft Only Platforms
web forms and Server
Side Scripting
Form processing script
Steps to Form Processing Script
 Creating the HTML code for the form
<form action="myform.php" method="post">
<!-- form fields here -->
</form>
The “action” specifies what page to submit the form to.
The “method” indicates how the form is submitted :Get
and Post.
Most of the time, forms will use the “post” method.
Steps to Form Processing Script
<form action="myform.php" method="post">
Which is your favorite movie?
<input type="text" name="formMovie"
maxlength="50">
<input type="submit" name="formSubmit"
value="Submit">
</form>
Steps to Form Processing Script
 Getting the form data:
The input of type “text” is just a single line field
to type in some text. We give it a name of
“formMovie” .
You have a button submit that submits the whole
form once clicked on.
Steps to Form Processing Script
<?php
if($_POST['formSubmit'] == "Submit")
{
$varMovie = $_POST['formMovie']; }
?>
<form action="myform.php" method="post">
Which is your favorite movie?
<input type="text" name="formMovie" maxlength="50">
<input type="submit" name="formSubmit" value="Submit">
</form>
Steps to Form Processing Script
 Validating the input:
Suppose we have a user who forgot to enter one of the fields?
We need to validate the form to make sure it’s complete and
filled out with valid information.
Steps to Form Processing Script
<?php
if($_POST['formSubmit'] == "Submit")
{
$errorMessage = "";
if(empty($_POST['formMovie']))
{
$errorMessage .= "<li>You forgot to enter a movie!</li>";
}
Steps to Form Processing Script
if(empty($_POST['formName']))
{
$errorMessage .= "<li>You forgot to enter a
name!</li>";
}
$varMovie = $_POST['formMovie'];
$varName = $_POST['formName'];
Steps to Form Processing Script
if(!empty($errorMessage))
{
echo("<p>There was an error with your
form:</p>n");
echo("<ul>" . $errorMessage . "</ul>n");
}
}
?>
PHP: how to connect to
the server?
PHP: How to connect to the
server?
 Option 1: Website on a hosted server
 Option 2: Install PHP on your computer
 Option 3: XAMPP

Website on a hosted server
 Create a file in Notepad (or similar text editor)
named test.php
 Insert the following code in the file:
<?php echo "Hello World!"; ?>
 Upload the file to your web host.
 Open the file in your browser.
 If the browser writes "Hello World!" your web host
supports PHP and you are ready to go. Otherwise
contact your hosting provider for more information.
Install PHP on your computer
 We will learn more about this option in
practice using EasyPhp.
XAMPP
 Open the program XAMPP Control Panel
 Start the Apache server and the MySql server:
 Create a file in Notepad named test.php .
 Insert the following code in the file:
<?php echo "Hello World!"; ?>
 Save the file in the folder "c:xampphtdocs".
 Open the file in your browser with the address
http://localhost/test.php.
 If the browser writes "Hello World!" the installation is
successful, and you're ready to run PHP on your computer.

More Related Content

PPTX
Virtual machine
PPTX
Pizza ordering system
PPTX
Virtual machine
PDF
Embracing DevOps through database migrations with Flyway
PPTX
VMware vSphere technical presentation
PDF
Virtualization Technology Overview
PDF
Cloud Computing Service Models | IaaS PaaS SaaS Explained | Cloud Masters Pro...
PPTX
Server virtualization
Virtual machine
Pizza ordering system
Virtual machine
Embracing DevOps through database migrations with Flyway
VMware vSphere technical presentation
Virtualization Technology Overview
Cloud Computing Service Models | IaaS PaaS SaaS Explained | Cloud Masters Pro...
Server virtualization

What's hot (20)

PPT
OS Functions and Services
PPTX
Introduction to Enterprise Data Storage, Direct Attached Storage, Storage Ar...
PDF
Active directory interview questions
PPTX
Types of operating system unit 1 by Ram K Paliwal
PPTX
Virtualization
PDF
Introduction to virtualization
PPTX
OS multiprocessing -.pptx
PPT
PPTX
Introduction to Hyper-V
PPTX
library management system
PDF
Lecture5 virtualization
PDF
Server Virtualization
PDF
Linux System Monitoring basic commands
DOC
A Project Report on Linux Server Administration
PPTX
3. CPU virtualization and scheduling
PPTX
Introduction to ASP.NET
PPTX
Restaurant Management System
PPTX
Network Virtualization
PPT
Introduction to Virtualization
PPTX
Stock Management System
OS Functions and Services
Introduction to Enterprise Data Storage, Direct Attached Storage, Storage Ar...
Active directory interview questions
Types of operating system unit 1 by Ram K Paliwal
Virtualization
Introduction to virtualization
OS multiprocessing -.pptx
Introduction to Hyper-V
library management system
Lecture5 virtualization
Server Virtualization
Linux System Monitoring basic commands
A Project Report on Linux Server Administration
3. CPU virtualization and scheduling
Introduction to ASP.NET
Restaurant Management System
Network Virtualization
Introduction to Virtualization
Stock Management System
Ad

Similar to Web forms and server side scripting (20)

PPT
An Introduction to Websphere sMash for PHP Programmers
PPT
DevNext - Web Programming Concepts Using Asp Net
PDF
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
PPTX
The Functional Web
PPT
PHP and MySQL
PPTX
My Saminar On Php
PPTX
Introduction to php
PPT
Intro To Asp Net And Web Forms
PPT
Web Development Environments: Choose the best or go with the rest
PPT
Dh2 Apps Training Part2
PDF
Intro To Asp
PPTX
Top 15 asp dot net interview questions and answers
PPTX
Top 15-asp-dot-net-interview-questions-and-answers
PPT
Php intro
PPT
Php intro
PPT
Php intro
PPTX
ASP.NET - Ivan Marković
PPT
ASP_NET_Architecture_Interfgfgfgnals1.ppt
PPT
Jsp Comparison
An Introduction to Websphere sMash for PHP Programmers
DevNext - Web Programming Concepts Using Asp Net
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
The Functional Web
PHP and MySQL
My Saminar On Php
Introduction to php
Intro To Asp Net And Web Forms
Web Development Environments: Choose the best or go with the rest
Dh2 Apps Training Part2
Intro To Asp
Top 15 asp dot net interview questions and answers
Top 15-asp-dot-net-interview-questions-and-answers
Php intro
Php intro
Php intro
ASP.NET - Ivan Marković
ASP_NET_Architecture_Interfgfgfgnals1.ppt
Jsp Comparison
Ad

More from sawsan slii (13)

PPTX
Ch1 traditional it and cloud
PPTX
Aws principle services: IAM,VPC, EC2, Cloudwatch
PPTX
Introduction to exploring hci
PPTX
Design principles
PPTX
Introduction hci
PPTX
Ch1 traditional it and cloud
PPTX
Cache mapping exercises
PPTX
Fileprocessing lec-7
PPTX
evaluation techniques in HCI
PPTX
Evaluation techniques in HCI
PDF
Ajax and xml
PPT
UCD and low-fidelity prototyping
PPT
Web server administration
Ch1 traditional it and cloud
Aws principle services: IAM,VPC, EC2, Cloudwatch
Introduction to exploring hci
Design principles
Introduction hci
Ch1 traditional it and cloud
Cache mapping exercises
Fileprocessing lec-7
evaluation techniques in HCI
Evaluation techniques in HCI
Ajax and xml
UCD and low-fidelity prototyping
Web server administration

Recently uploaded (20)

PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PDF
The Internet -By the Numbers, Sri Lanka Edition
PPTX
SAP Ariba Sourcing PPT for learning material
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
PPTX
Funds Management Learning Material for Beg
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
Triggering QUIC, presented by Geoff Huston at IETF 123
PPTX
Digital Literacy And Online Safety on internet
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PPTX
artificial intelligence overview of it and more
PPT
tcp ip networks nd ip layering assotred slides
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
international classification of diseases ICD-10 review PPT.pptx
Slides PPTX World Game (s) Eco Economic Epochs.pptx
INTERNET------BASICS-------UPDATED PPT PRESENTATION
522797556-Unit-2-Temperature-measurement-1-1.pptx
The Internet -By the Numbers, Sri Lanka Edition
SAP Ariba Sourcing PPT for learning material
RPKI Status Update, presented by Makito Lay at IDNOG 10
Funds Management Learning Material for Beg
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Triggering QUIC, presented by Geoff Huston at IETF 123
Digital Literacy And Online Safety on internet
PptxGenJS_Demo_Chart_20250317130215833.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Job_Card_System_Styled_lorem_ipsum_.pptx
Introuction about WHO-FIC in ICD-10.pptx
artificial intelligence overview of it and more
tcp ip networks nd ip layering assotred slides
Unit-1 introduction to cyber security discuss about how to secure a system
WebRTC in SignalWire - troubleshooting media negotiation
The New Creative Director: How AI Tools for Social Media Content Creation Are...
international classification of diseases ICD-10 review PPT.pptx

Web forms and server side scripting

  • 1. Web forms and Server Side Scripting Sawsan Slii Marzouki Internet Applicatiosn Development
  • 3. What is a server?  Many types of server: File server FTP server Web server Mail server News server
  • 4. Dynamic Interactive Web Server (3-tier architecture(
  • 6. Web content  HTML documents are static  Dynamic content :  User side programming (JavaScript, CSS, Ajax, JQuery……)  Server side programming (PHP, ASP and ASP.Net, JSP, Python….)
  • 7. Why Server Side Programming?  Accessibility : Any one can reach Internet.  Manageability : Does not require distribution of application code  Security : Source code is not exposed  Scalability : (‫)تطور‬ Web-based 3-tier architecture can scale out
  • 8. History of web dynamic content  Common Gateway Interface (CGI) was the first generation approach to providing dynamic web content (used scripts)  Numerous second generation alternatives were invented (FastCGI, mod_Perl, NSAPI, ISAPI, Java Servlets…)  Scripting, the third generation approach
  • 9. Scripting, the third generation approach  Embed simple code in HTML pages  The HTML pages use the code to decide what elements to display and what data should be displayed.  Classes and/or subroutines can be called to compute information for inclusion in the web page.  This is know as « scripting ».
  • 10. Scripting languages or compiled Scripting languages Compiled languages Server Side Includes (SSI) Perl PHP ASP (VBScript) Python C C++ ASP.Net Java Servlet Java Server Pages
  • 11. Some approaches to Scripting  JavaServer Pages (JSP) by Sun MicroSystems  Hypertext Preprocessor (PHP): open source  Cold Fusion (CFML) by Macromedia  Active Server Pages (ASP and ASP.Net) by MicroSoft
  • 12. Criteria affecting Scripting choice  Web Server availability  Knowledge of language  Scalability and efficiency  Personal preference
  • 13. Learn more about JSP, PHP and ASP.Net
  • 14. JSP (Java Server Pages(  Java-based technology that simplifies the development of dynamic websites  Designed around the Java Philosophy  Packaged with J2EE  It separates presentation aspects from programming logic contained in the code.
  • 15. J2EE Technology  Web container (application server)  EJB container  Servlets : JSP pages running in webServers  JSP: JavaServer Pages  Apples, XML, JDBC, …….
  • 17. JSP Basics  Individual JSP pages are text files stored on the web server.  When a page is first required, then JSP Engine uses the page to generate a Servlet.  The compiled Servlet is saved and used to serve additional requests.  When a page is modified, the appropriate Servlet is regenerated.  Precompilation is also possible
  • 18. A simple JSP code  New.java.util.Date().ToString(): creates a date Object and converts it to a String that can be displayed
  • 19. What is PHP?  Open source Server-Side Scripting language designed specifically for the web.  Conceived in 1994.  Supports a wide-range of databases.  Perl and C like syntax.  Designed similar to ASP: you embed commands into your web pages.
  • 20. What is PHP?  Commands are preprocessed by Php processor and appropriate HTML is sent to the web server.  Platoform independant  Easy to learn  Usually associated to MySQL database (a relational free DBMS, can run on Unix, Windows, and Mac OS).
  • 23. ASP.Net  Based on .Net Framework and the common language runtime (CLR)  Compiled language  MicroSoft Only Platforms
  • 24. web forms and Server Side Scripting
  • 26. Steps to Form Processing Script  Creating the HTML code for the form <form action="myform.php" method="post"> <!-- form fields here --> </form> The “action” specifies what page to submit the form to. The “method” indicates how the form is submitted :Get and Post. Most of the time, forms will use the “post” method.
  • 27. Steps to Form Processing Script <form action="myform.php" method="post"> Which is your favorite movie? <input type="text" name="formMovie" maxlength="50"> <input type="submit" name="formSubmit" value="Submit"> </form>
  • 28. Steps to Form Processing Script  Getting the form data: The input of type “text” is just a single line field to type in some text. We give it a name of “formMovie” . You have a button submit that submits the whole form once clicked on.
  • 29. Steps to Form Processing Script <?php if($_POST['formSubmit'] == "Submit") { $varMovie = $_POST['formMovie']; } ?> <form action="myform.php" method="post"> Which is your favorite movie? <input type="text" name="formMovie" maxlength="50"> <input type="submit" name="formSubmit" value="Submit"> </form>
  • 30. Steps to Form Processing Script  Validating the input: Suppose we have a user who forgot to enter one of the fields? We need to validate the form to make sure it’s complete and filled out with valid information.
  • 31. Steps to Form Processing Script <?php if($_POST['formSubmit'] == "Submit") { $errorMessage = ""; if(empty($_POST['formMovie'])) { $errorMessage .= "<li>You forgot to enter a movie!</li>"; }
  • 32. Steps to Form Processing Script if(empty($_POST['formName'])) { $errorMessage .= "<li>You forgot to enter a name!</li>"; } $varMovie = $_POST['formMovie']; $varName = $_POST['formName'];
  • 33. Steps to Form Processing Script if(!empty($errorMessage)) { echo("<p>There was an error with your form:</p>n"); echo("<ul>" . $errorMessage . "</ul>n"); } } ?>
  • 34. PHP: how to connect to the server?
  • 35. PHP: How to connect to the server?  Option 1: Website on a hosted server  Option 2: Install PHP on your computer  Option 3: XAMPP 
  • 36. Website on a hosted server  Create a file in Notepad (or similar text editor) named test.php  Insert the following code in the file: <?php echo "Hello World!"; ?>  Upload the file to your web host.  Open the file in your browser.  If the browser writes "Hello World!" your web host supports PHP and you are ready to go. Otherwise contact your hosting provider for more information.
  • 37. Install PHP on your computer  We will learn more about this option in practice using EasyPhp.
  • 38. XAMPP  Open the program XAMPP Control Panel  Start the Apache server and the MySql server:  Create a file in Notepad named test.php .  Insert the following code in the file: <?php echo "Hello World!"; ?>  Save the file in the folder "c:xampphtdocs".  Open the file in your browser with the address http://localhost/test.php.  If the browser writes "Hello World!" the installation is successful, and you're ready to run PHP on your computer.