AIMS AND OBJECTIVES
Web Server Scripting
• Create a form in PHP
• Transfer data to another page using PHP
Web Server Scripting
Server Side Languages
PHP RECAP
<? php
Code
?>
Web Server Scripting
Server Side Languages
PHP RECAP
Variables
$x = 0; // sets up a variable
Web Server Scripting
Server Side Languages
Creating a form:
You do this in normal HTML code (but
still save it as a PHP page). Look at the
handout sheet for the form.
Web Server Scripting
Server Side Languages
When you submit the form:
<form method="post" action="result.php">
The server looks for result.php
All the text boxes full of information are
turned into php variables
Web Server Scripting
Server Side Languages
On result .php…
For example the text box called
first_name
Becomes $_POST['first_name'];
You can then use that variable.
Web Server Scripting
Server Side Languages
$first_name = $_POST['first_name'];
Stores the first_name in a semi-
permanent variable called $first_name.
You can then “echo” it or store it.
Web Server Scripting
Server Side Languages
On result.php
Echo $first_name.”<br>”;
Web Server Scripting
Server Side Languages
PHP – Forms
Passing Variables from a Form:
Welcome <?php echo $first_name; ?>!<br />
You are <?php echo $age; ?> years old.
Web Server Scripting
Server Side Languages
Use the handout to create form.php
And result.php which shows what has
been entered into the form.
Save in public_html
View at
Web Server Scripting
Extension:
Try using method=“GET” instead of
Method=“POST”
What is the difference?

More Related Content

PDF
CakePHP 3
PPTX
Php basics
PPTX
Web application using JSP
PDF
faster frontend development with textmate
PDF
WooCommerce: Intro to PHP
PPT
Wordpress install setup
PDF
Thymeleaf Introduction
PDF
Introduction to thymeleaf
CakePHP 3
Php basics
Web application using JSP
faster frontend development with textmate
WooCommerce: Intro to PHP
Wordpress install setup
Thymeleaf Introduction
Introduction to thymeleaf

What's hot (13)

PDF
Introducing thymeleaf
ODP
PHP and PDFLib
PPTX
Caching and invalidating with managed store
 
PPT
Wonka.js introduction
PPTX
Caching and invalidating with managed store
TXT
20170310 PHP goal pyramid for memorising
PDF
Ruby de Rails
ODP
Javascript debugging
PPT
ODP
Sourcerer and Joomla! rev. 20130903
PPTX
HackU PHP and Node.js
PPTX
Mule xml parsing
PPTX
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Introducing thymeleaf
PHP and PDFLib
Caching and invalidating with managed store
 
Wonka.js introduction
Caching and invalidating with managed store
20170310 PHP goal pyramid for memorising
Ruby de Rails
Javascript debugging
Sourcerer and Joomla! rev. 20130903
HackU PHP and Node.js
Mule xml parsing
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Ad

Viewers also liked (8)

PPT
PHP - Introduction to PHP Forms
PPTX
Form Script
PPT
Chapter 07 php forms handling
PPTX
3 php forms
PPTX
Php Form
PPT
Php forms
ODP
Form Processing In Php
PDF
Login and Registration form using oop in php
PHP - Introduction to PHP Forms
Form Script
Chapter 07 php forms handling
3 php forms
Php Form
Php forms
Form Processing In Php
Login and Registration form using oop in php
Ad

Similar to Web server scripting - Using a form (20)

PPTX
Web Application Development using PHP Chapter 1
PPT
10_introduction_php.ppt
PPT
10_introduction_php.ppt
PPT
introduction_php.ppt
PPTX
introduction to php and its uses in daily
PPTX
Php technical presentation
PPTX
PHP.pptx is the Best Explanation of ppts
PPTX
INTRODUCTION to php.pptx
PDF
Lecture14-Introduction to PHP-coding.pdf
PPT
php 1
PPTX
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
PPT
PHP MySQL Workshop - facehook
PPTX
1. introduction to php and variable
PPTX
php (Hypertext Preprocessor)
PPTX
PDF
PHP in Web development and Applications.pdf
PPTX
PHP Hypertext Preprocessor
PDF
Introduction to php
PPT
PHP - Introduction to PHP Fundamentals
Web Application Development using PHP Chapter 1
10_introduction_php.ppt
10_introduction_php.ppt
introduction_php.ppt
introduction to php and its uses in daily
Php technical presentation
PHP.pptx is the Best Explanation of ppts
INTRODUCTION to php.pptx
Lecture14-Introduction to PHP-coding.pdf
php 1
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
PHP MySQL Workshop - facehook
1. introduction to php and variable
php (Hypertext Preprocessor)
PHP in Web development and Applications.pdf
PHP Hypertext Preprocessor
Introduction to php
PHP - Introduction to PHP Fundamentals

Recently uploaded (20)

PPTX
Build Your First AI Agent with UiPath.pptx
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PPTX
Configure Apache Mutual Authentication
PPT
Geologic Time for studying geology for geologist
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
2018-HIPAA-Renewal-Training for executives
PDF
Five Habits of High-Impact Board Members
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PPTX
Modernising the Digital Integration Hub
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PDF
Comparative analysis of machine learning models for fake news detection in so...
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Build Your First AI Agent with UiPath.pptx
Taming the Chaos: How to Turn Unstructured Data into Decisions
Developing a website for English-speaking practice to English as a foreign la...
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
Convolutional neural network based encoder-decoder for efficient real-time ob...
Configure Apache Mutual Authentication
Geologic Time for studying geology for geologist
1 - Historical Antecedents, Social Consideration.pdf
sbt 2.0: go big (Scala Days 2025 edition)
Chapter 5: Probability Theory and Statistics
2018-HIPAA-Renewal-Training for executives
Five Habits of High-Impact Board Members
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Modernising the Digital Integration Hub
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
Comparative analysis of machine learning models for fake news detection in so...
A contest of sentiment analysis: k-nearest neighbor versus neural network
NewMind AI Weekly Chronicles – August ’25 Week III
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx

Web server scripting - Using a form

  • 1. AIMS AND OBJECTIVES Web Server Scripting • Create a form in PHP • Transfer data to another page using PHP
  • 2. Web Server Scripting Server Side Languages PHP RECAP <? php Code ?>
  • 3. Web Server Scripting Server Side Languages PHP RECAP Variables $x = 0; // sets up a variable
  • 4. Web Server Scripting Server Side Languages Creating a form: You do this in normal HTML code (but still save it as a PHP page). Look at the handout sheet for the form.
  • 5. Web Server Scripting Server Side Languages When you submit the form: <form method="post" action="result.php"> The server looks for result.php All the text boxes full of information are turned into php variables
  • 6. Web Server Scripting Server Side Languages On result .php… For example the text box called first_name Becomes $_POST['first_name']; You can then use that variable.
  • 7. Web Server Scripting Server Side Languages $first_name = $_POST['first_name']; Stores the first_name in a semi- permanent variable called $first_name. You can then “echo” it or store it.
  • 8. Web Server Scripting Server Side Languages On result.php Echo $first_name.”<br>”;
  • 9. Web Server Scripting Server Side Languages PHP – Forms Passing Variables from a Form: Welcome <?php echo $first_name; ?>!<br /> You are <?php echo $age; ?> years old.
  • 10. Web Server Scripting Server Side Languages Use the handout to create form.php And result.php which shows what has been entered into the form. Save in public_html View at
  • 11. Web Server Scripting Extension: Try using method=“GET” instead of Method=“POST” What is the difference?