This document provides an introduction to PHP, covering topics like server-side web programming, the client-server model, and what PHP is and how it works. PHP is a server-side scripting language that is interpreted and executed on the server before content is sent to the client. The document outlines PHP language basics like syntax, variables, operators, and control structures. It also discusses how PHP can interact with HTML forms submitted by clients.
This document provides an introduction to PHP (Hypertext Preprocessor), which is a server-side scripting language used for web development. It discusses three-tiered websites, server-side scripting, and some key aspects of PHP including its history, basic syntax, variables, data types, functions, and conditional statements. PHP allows for dynamic content generation, computational processing, database access, and more on the server side to create interactive websites and web applications.
The document discusses PHP forms and form handling. It explains that the $_GET and $_POST superglobals are used to collect form data submitted via GET or POST methods. It provides an example HTML form that submits to a PHP file and displays the submitted data. The differences between GET and POST are outlined, including when each method should be used. Validation of required fields is demonstrated with PHP code. Other PHP topics like dates, times, and including files are briefly covered.
This document provides an introduction to PHP, including an overview of server-side scripting, the basic PHP syntax, variables, operators, control structures like conditional statements and loops, and how PHP code is processed. It explains what PHP is, how it is widely used for building dynamic websites, and the basic components needed to develop PHP applications including a web server, PHP, and a database.
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
This document provides an introduction to PHP, including an overview of server-side scripting, how PHP code is processed, basic PHP syntax, variables, operators, control structures like conditional statements and loops, and other key PHP concepts. It explains what PHP is, how it is used to create dynamic web content, and some of the basic building blocks needed to get started with PHP programming.
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Muhamad Al Imran
This document provides an introduction to PHP, including an overview of server-side scripting, how PHP code is processed, basic PHP syntax, variables, operators, control structures like conditional statements and loops, and other key PHP concepts. It explains what PHP is, how it is used to create dynamic web content, and some of the basic building blocks needed to get started with PHP programming.
PHP is a widely-used open source scripting language suited for web development. It allows embedding code into HTML pages to make them dynamic. PHP code is executed on the server and generates HTML that is sent to the client. Key features include using variables, conditional statements, loops, functions, and interacting with databases or external sources. The document provides an introduction to basic PHP syntax and constructs like variables, arrays, operators, control structures, and functions.
This document provides an introduction to PHP (Hypertext Preprocessor), which is a server-side scripting language used for web development. It discusses three-tiered websites, server-side scripting, and some key aspects of PHP including its history, basic syntax, variables, data types, functions, and conditional statements. PHP allows for dynamic content generation, computational processing, database access, and more on the server side to create interactive websites and web applications.
The document discusses PHP forms and form handling. It explains that the $_GET and $_POST superglobals are used to collect form data submitted via GET or POST methods. It provides an example HTML form that submits to a PHP file and displays the submitted data. The differences between GET and POST are outlined, including when each method should be used. Validation of required fields is demonstrated with PHP code. Other PHP topics like dates, times, and including files are briefly covered.
This document provides an introduction to PHP, including an overview of server-side scripting, the basic PHP syntax, variables, operators, control structures like conditional statements and loops, and how PHP code is processed. It explains what PHP is, how it is widely used for building dynamic websites, and the basic components needed to develop PHP applications including a web server, PHP, and a database.
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
This document provides an introduction to PHP, including an overview of server-side scripting, how PHP code is processed, basic PHP syntax, variables, operators, control structures like conditional statements and loops, and other key PHP concepts. It explains what PHP is, how it is used to create dynamic web content, and some of the basic building blocks needed to get started with PHP programming.
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Muhamad Al Imran
This document provides an introduction to PHP, including an overview of server-side scripting, how PHP code is processed, basic PHP syntax, variables, operators, control structures like conditional statements and loops, and other key PHP concepts. It explains what PHP is, how it is used to create dynamic web content, and some of the basic building blocks needed to get started with PHP programming.
PHP is a widely-used open source scripting language suited for web development. It allows embedding code into HTML pages to make them dynamic. PHP code is executed on the server and generates HTML that is sent to the client. Key features include using variables, conditional statements, loops, functions, and interacting with databases or external sources. The document provides an introduction to basic PHP syntax and constructs like variables, arrays, operators, control structures, and functions.
PHP Basics is a presentation that introduces PHP. It discusses that PHP is a server-side scripting language used for building dynamic websites. It can be embedded into HTML. When a PHP file is requested, the server processes the PHP code and returns the output to the browser as HTML. The presentation covers PHP syntax, variables, data types, operators, functions, and conditional statements. It provides examples to illustrate basic PHP concepts and functionality.
The document provides an overview of web programming using PHP and MySQL. It explains that PHP is a server-side scripting language used to build dynamic web sites and applications. MySQL is a database server program commonly used with PHP. The document then covers various aspects of PHP coding structure, syntax, and common features like variables, data types, operators, and form submission.
The document provides an introduction to PHP and writing PHP code. It discusses request-response communication, client-side scripting, session management, installing and configuring PHP and MySQL. It also covers how PHP code is parsed, embedding PHP and HTML, data types in PHP, operators, variables, comments, and more. The document is a training guide that walks through PHP fundamentals and concepts over multiple pages.
The document provides an overview of PHP and its capabilities compared to other web technologies. It discusses how PHP allows for dynamic content and user interactivity on websites, unlike static HTML. It also summarizes HTTP and the client-server model, and how PHP integrates as a common gateway interface (CGI) to enable server-side scripting. Key topics covered include the history of HTML/XHTML, HTTP request/response formats, and how PHP addresses limitations of static websites by running on the server-side.
This document provides an introduction to learning PHP over 6 weeks. It covers topics like getting started with a "Hello World" example, commenting code, PHP language basics like types and variables, constants, operators, loops, forms, emails, dates, includes, databases, cookies, sessions, and creating a content management system. The introduction explains what PHP is and common uses. Sections are dedicated to explaining comments, language references, and providing code examples for concepts covered.
This document provides an introduction to learning PHP over 6 weeks. It covers topics like getting started with "Hello World", commenting code, language basics like variables and constants, operators, loops, handling forms, emails, dates, includes, MySQL, cookies, sessions, and creating tables. The document contains sample code and explanations to demonstrate each concept. It is intended to teach PHP fundamentals and common tasks to readers in a structured way over 6 weeks.
This document provides an introduction to learning PHP over 6 weeks. It covers topics like getting started with a "Hello World" example, commenting code, PHP language basics like types and variables, constants, operators, loops, forms, emails, dates, includes, databases, cookies, sessions, and creating a content management system. The introduction explains what PHP is and common uses. Sections are dedicated to explaining comments, language references, and providing code examples for concepts covered.
The document discusses how to use PHP in HTML by wrapping PHP code in opening <?php and closing ?> tags. There are two main ways: 1) Put PHP code directly in HTML files with a .html extension, but servers typically only process .php files; 2) Mix PHP and HTML tags in .php files, which is better. The document provides examples of embedding PHP code to output text, dates, and looping through arrays to generate HTML lists. It also discusses using include() and require() functions to share common code across files.
The document provides an overview of forms in HTML and PHP form handling. It defines what an HTML form is, including the <form> tag and its attributes like action and method. It describes common input elements like text, textarea, radio buttons, select boxes, and passwords. It explains how forms submit data to PHP using the POST method and how that data can be accessed in PHP using the name attributes of each form element.
PHP is an open source scripting language used for web development that can be embedded into HTML. It is executed on the server and allows code to be enclosed in special PHP tags. Variables in PHP start with a $ sign and automatically take the correct data type. Strings can be concatenated using the . operator and PHP supports various operators like arithmetic, assignment, comparison, and logical for working with values.
PHP is a server-side scripting language used for web development. It allows developers to embed PHP code into HTML pages which is then interpreted and executed by a PHP processor on the server to generate dynamic web pages. PHP code is contained within special tags and can be used to store and retrieve data from databases, create forms, send emails, and more. Some key PHP features include variables, functions, object-oriented capabilities, and file uploads. The php.ini configuration file controls aspects of PHP's behavior.
This is the presentation from Null/OWASP/g4h December Bangalore MeetUp by Akash Mahajan.
technology.inmobi.com/events/null-owasp-g4h-december-meetup
Abstract:
This will cover the basics of Hyper Text Transfer Protocol. You will learn how to send HTTP requests like GET, POST by crafting them manually and using a command line tool like CURL. You will also see how session management using cookies happens using the same tools.
To practice along please install curl (http://curl.haxx.se/download.html).
This document provides an overview of the PHP programming language. It discusses that PHP is a server-side scripting language used for building dynamic web applications. It can be used to collect form data, generate dynamic page content, create and manage files and databases on the server. The document then demonstrates basic PHP syntax and shows how to output text and variables to the browser. It also covers PHP data types like strings, integers, arrays and objects. Finally, it provides examples of common string manipulation functions in PHP.
Module-3 15CS71-WTA-Serverside Development with PHPSIVAKUMAR V
It Covers subject 15CS71-Web Technology and Its Applications, Module-3, from B.E. Computer Science & Engineering- Semester–VII, under Visvesvaraya Technological University, Belagavi
Drupal is an open source content management system (CMS) written in PHP and uses a MySQL database. It allows users to build dynamic websites and provides features like content authoring, taxonomy, views, and customizable modules. The document discusses Drupal fundamentals like nodes, modules, blocks, menus, and user permissions. It also provides an overview of using HTML, CSS, PHP, and MySQL to develop websites with Drupal.
The document discusses HTML tags and PHP. It provides an introduction to PHP including what PHP is, how PHP files work, what PHP can do, and why PHP is useful. It also covers basic PHP syntax, variables, echo and print statements, and variable scope.
PHP: Why PHP and MySQL? Server-side scripting, PHP syntax and variables, comments, types, control structures, branching, looping, termination, functions, passing information with PHP, GET, POST, formatting form variables, superglobal arrays, strings and string functions, regular expressions, arrays, number handling, basic PHP errors/problems
PHP is an open-source, server-side scripting language used for web development. It was created in 1994 and allows embedding code into HTML documents. PHP is a popular choice due to its performance, open-source availability, ease of use, and support for dynamic content and databases. It has a large community for learning and support.
PHP is a widely used scripting language for web development. It was created in 1994 and has evolved through several versions, adding features like object oriented programming. PHP code is embedded into HTML and processed by the server before pages are sent to the browser. It is free, easy to use, cross-platform, and supports many databases, making it a popular choice for building dynamic web applications and sites.
The document provides an introduction and overview of PHP including a brief history, getting started instructions, examples of using PHP for templates and page counters, and additional resources. It discusses how PHP was created in 1994 and evolved through versions 2-5, how to embed PHP code in HTML pages using tags, demonstrates conditional statements and includes, and provides a step-by-step example of implementing a simple page counter using PHP.
PHP Basics is a presentation that introduces PHP. It discusses that PHP is a server-side scripting language used for building dynamic websites. It can be embedded into HTML. When a PHP file is requested, the server processes the PHP code and returns the output to the browser as HTML. The presentation covers PHP syntax, variables, data types, operators, functions, and conditional statements. It provides examples to illustrate basic PHP concepts and functionality.
The document provides an overview of web programming using PHP and MySQL. It explains that PHP is a server-side scripting language used to build dynamic web sites and applications. MySQL is a database server program commonly used with PHP. The document then covers various aspects of PHP coding structure, syntax, and common features like variables, data types, operators, and form submission.
The document provides an introduction to PHP and writing PHP code. It discusses request-response communication, client-side scripting, session management, installing and configuring PHP and MySQL. It also covers how PHP code is parsed, embedding PHP and HTML, data types in PHP, operators, variables, comments, and more. The document is a training guide that walks through PHP fundamentals and concepts over multiple pages.
The document provides an overview of PHP and its capabilities compared to other web technologies. It discusses how PHP allows for dynamic content and user interactivity on websites, unlike static HTML. It also summarizes HTTP and the client-server model, and how PHP integrates as a common gateway interface (CGI) to enable server-side scripting. Key topics covered include the history of HTML/XHTML, HTTP request/response formats, and how PHP addresses limitations of static websites by running on the server-side.
This document provides an introduction to learning PHP over 6 weeks. It covers topics like getting started with a "Hello World" example, commenting code, PHP language basics like types and variables, constants, operators, loops, forms, emails, dates, includes, databases, cookies, sessions, and creating a content management system. The introduction explains what PHP is and common uses. Sections are dedicated to explaining comments, language references, and providing code examples for concepts covered.
This document provides an introduction to learning PHP over 6 weeks. It covers topics like getting started with "Hello World", commenting code, language basics like variables and constants, operators, loops, handling forms, emails, dates, includes, MySQL, cookies, sessions, and creating tables. The document contains sample code and explanations to demonstrate each concept. It is intended to teach PHP fundamentals and common tasks to readers in a structured way over 6 weeks.
This document provides an introduction to learning PHP over 6 weeks. It covers topics like getting started with a "Hello World" example, commenting code, PHP language basics like types and variables, constants, operators, loops, forms, emails, dates, includes, databases, cookies, sessions, and creating a content management system. The introduction explains what PHP is and common uses. Sections are dedicated to explaining comments, language references, and providing code examples for concepts covered.
The document discusses how to use PHP in HTML by wrapping PHP code in opening <?php and closing ?> tags. There are two main ways: 1) Put PHP code directly in HTML files with a .html extension, but servers typically only process .php files; 2) Mix PHP and HTML tags in .php files, which is better. The document provides examples of embedding PHP code to output text, dates, and looping through arrays to generate HTML lists. It also discusses using include() and require() functions to share common code across files.
The document provides an overview of forms in HTML and PHP form handling. It defines what an HTML form is, including the <form> tag and its attributes like action and method. It describes common input elements like text, textarea, radio buttons, select boxes, and passwords. It explains how forms submit data to PHP using the POST method and how that data can be accessed in PHP using the name attributes of each form element.
PHP is an open source scripting language used for web development that can be embedded into HTML. It is executed on the server and allows code to be enclosed in special PHP tags. Variables in PHP start with a $ sign and automatically take the correct data type. Strings can be concatenated using the . operator and PHP supports various operators like arithmetic, assignment, comparison, and logical for working with values.
PHP is a server-side scripting language used for web development. It allows developers to embed PHP code into HTML pages which is then interpreted and executed by a PHP processor on the server to generate dynamic web pages. PHP code is contained within special tags and can be used to store and retrieve data from databases, create forms, send emails, and more. Some key PHP features include variables, functions, object-oriented capabilities, and file uploads. The php.ini configuration file controls aspects of PHP's behavior.
This is the presentation from Null/OWASP/g4h December Bangalore MeetUp by Akash Mahajan.
technology.inmobi.com/events/null-owasp-g4h-december-meetup
Abstract:
This will cover the basics of Hyper Text Transfer Protocol. You will learn how to send HTTP requests like GET, POST by crafting them manually and using a command line tool like CURL. You will also see how session management using cookies happens using the same tools.
To practice along please install curl (http://curl.haxx.se/download.html).
This document provides an overview of the PHP programming language. It discusses that PHP is a server-side scripting language used for building dynamic web applications. It can be used to collect form data, generate dynamic page content, create and manage files and databases on the server. The document then demonstrates basic PHP syntax and shows how to output text and variables to the browser. It also covers PHP data types like strings, integers, arrays and objects. Finally, it provides examples of common string manipulation functions in PHP.
Module-3 15CS71-WTA-Serverside Development with PHPSIVAKUMAR V
It Covers subject 15CS71-Web Technology and Its Applications, Module-3, from B.E. Computer Science & Engineering- Semester–VII, under Visvesvaraya Technological University, Belagavi
Drupal is an open source content management system (CMS) written in PHP and uses a MySQL database. It allows users to build dynamic websites and provides features like content authoring, taxonomy, views, and customizable modules. The document discusses Drupal fundamentals like nodes, modules, blocks, menus, and user permissions. It also provides an overview of using HTML, CSS, PHP, and MySQL to develop websites with Drupal.
The document discusses HTML tags and PHP. It provides an introduction to PHP including what PHP is, how PHP files work, what PHP can do, and why PHP is useful. It also covers basic PHP syntax, variables, echo and print statements, and variable scope.
PHP: Why PHP and MySQL? Server-side scripting, PHP syntax and variables, comments, types, control structures, branching, looping, termination, functions, passing information with PHP, GET, POST, formatting form variables, superglobal arrays, strings and string functions, regular expressions, arrays, number handling, basic PHP errors/problems
PHP is an open-source, server-side scripting language used for web development. It was created in 1994 and allows embedding code into HTML documents. PHP is a popular choice due to its performance, open-source availability, ease of use, and support for dynamic content and databases. It has a large community for learning and support.
PHP is a widely used scripting language for web development. It was created in 1994 and has evolved through several versions, adding features like object oriented programming. PHP code is embedded into HTML and processed by the server before pages are sent to the browser. It is free, easy to use, cross-platform, and supports many databases, making it a popular choice for building dynamic web applications and sites.
The document provides an introduction and overview of PHP including a brief history, getting started instructions, examples of using PHP for templates and page counters, and additional resources. It discusses how PHP was created in 1994 and evolved through versions 2-5, how to embed PHP code in HTML pages using tags, demonstrates conditional statements and includes, and provides a step-by-step example of implementing a simple page counter using PHP.
Comparative analysis between traditional aquaponics and reconstructed aquapon...bijceesjournal
The aquaponic system of planting is a method that does not require soil usage. It is a method that only needs water, fish, lava rocks (a substitute for soil), and plants. Aquaponic systems are sustainable and environmentally friendly. Its use not only helps to plant in small spaces but also helps reduce artificial chemical use and minimizes excess water use, as aquaponics consumes 90% less water than soil-based gardening. The study applied a descriptive and experimental design to assess and compare conventional and reconstructed aquaponic methods for reproducing tomatoes. The researchers created an observation checklist to determine the significant factors of the study. The study aims to determine the significant difference between traditional aquaponics and reconstructed aquaponics systems propagating tomatoes in terms of height, weight, girth, and number of fruits. The reconstructed aquaponics system’s higher growth yield results in a much more nourished crop than the traditional aquaponics system. It is superior in its number of fruits, height, weight, and girth measurement. Moreover, the reconstructed aquaponics system is proven to eliminate all the hindrances present in the traditional aquaponics system, which are overcrowding of fish, algae growth, pest problems, contaminated water, and dead fish.
Embedded machine learning-based road conditions and driving behavior monitoringIJECEIAES
Car accident rates have increased in recent years, resulting in losses in human lives, properties, and other financial costs. An embedded machine learning-based system is developed to address this critical issue. The system can monitor road conditions, detect driving patterns, and identify aggressive driving behaviors. The system is based on neural networks trained on a comprehensive dataset of driving events, driving styles, and road conditions. The system effectively detects potential risks and helps mitigate the frequency and impact of accidents. The primary goal is to ensure the safety of drivers and vehicles. Collecting data involved gathering information on three key road events: normal street and normal drive, speed bumps, circular yellow speed bumps, and three aggressive driving actions: sudden start, sudden stop, and sudden entry. The gathered data is processed and analyzed using a machine learning system designed for limited power and memory devices. The developed system resulted in 91.9% accuracy, 93.6% precision, and 92% recall. The achieved inference time on an Arduino Nano 33 BLE Sense with a 32-bit CPU running at 64 MHz is 34 ms and requires 2.6 kB peak RAM and 139.9 kB program flash memory, making it suitable for resource-constrained embedded systems.
artificial intelligence and data science contents.pptxGauravCar
What is artificial intelligence? Artificial intelligence is the ability of a computer or computer-controlled robot to perform tasks that are commonly associated with the intellectual processes characteristic of humans, such as the ability to reason.
› ...
Artificial intelligence (AI) | Definitio
2. Topics Covered
Server side web programming
Client/Server systems
Comparison with static HTML
PHP - what is it? What does it do?
PHP Language basics
Syntax
Variables, Constants, Operators
Decision making
PHP and the client
3. Client/Server on the WWW
Standard web sites operate on a
request/response basis
A user requests a resource E.g. HTML
document
Server responds by delivering the document
to the client
The client processes the document and
displays it to user
4. Server Side Programming
Provides web site developers to utilise resources on
the web server
Non-public resources do not require direct access
from the clients
Allows web sites to be client agnostic (unless
JavaScript is used also)
Most server side programming script is embedded
within markup (although does not have to be,
sometimes better not to)
5. PHP - What is it / does it do?
PHP: PHP Hypertext Pre-processor
Programming language that is interpreted
and executed on the server
Execution is done before delivering content to
the client
Contains a vast library of functionality that
programmers can harness
Executes entirely on the server, requiring no
specific features from the client
6. PHP - What is it / does it do?
Static resources such as regular HTML are simply output to
the client from the server
Dynamic resources such as PHP scripts are processed on the
server prior to being output to the client
PHP has the capability of connecting to many database
systems making the entire process transparent to the client
User Web Server
PHP Engine –
Run Script
Web Page Request Load PHP File
PHP Results
HTML Response
7. PHP Summary
PHP: PHP Hypertext Pre-processor
Interpreted and executed by the server on
page request
Returns simple output to the client
Provides a tremendous amount of
functionality to programmers
Can connect transparently to many database
systems
8. PHP Language Basics
Look at the building blocks of the PHP
language
Syntax and structure
Variables, constants and operators
Data types and conversions
Decision making IF and switch
Interacting with the client application (HTML
forms)
9. PHP - Syntax and Structure
PHP is similar to C
All scripts start with <?php and with with ?>
Line separator: ; (semi-colon)
Code block: { //code here } (brace brackets)
White space is generally ignored (not in strings)
Comments are created using:
// single line quote
/* Multiple line block quote */
Precedence
Enforced using parentheses
E.g. $sum = 5 + 3 * 6; // would equal 23
$sum = (5 + 3) * 6; // would equal 48
10. PHP - Variables
Prefixed with a $
Assign values with = operator
Example: $author = “Trevor Adams”;
No need to define type
Variable names are case sensitive
$author and $Author are different
12. PHP - Constants
Constants are special variables that cannot
be changed
Use them for named items that will not
change
Created using a define function
define(‘milestokm’, 1.6);
Used without $
$km = 5 * milestokm;
13. PHP - Operators
Standard mathematical operators
+, -, *, / and % (modulus)
String concatenation with a period (.)
$car = “SEAT” . “ Altea”;
echo $car; would output “SEAT Altea”
Basic Boolean comparison with “==”
Using only = will overwrite a variable value
Less than < and greater than >
<= and >= as above but include equality
14. PHP - Data Types
PHP is not strictly typed
Different to JAVA where all variables are declared
A data type is either text or numeric
PHP decides what type a variable is
PHP can use variables in an appropriate way automatically
E.g.
$vat_rate = 0.175; /* VAT Rate is numeric */
echo $vat_rate * 100 . “%”; //outputs “17.5%”
$vat_rate is converted to a string for the purpose of the
echo statement
Object, Array and unknown also exist as types, Be
aware of them but we shall not explore them today
15. PHP - embedded language
PHP can be placed directly inside HTML E.g.
<html>
<head><title>Basic PHP page</title></head>
<body>
<h1><?php echo “Hello World!; ?></h1>
</body>
</html>
16. Decision Making - Basics
Decision making involves evaluating Boolean
expressions (true / false)
If($catishungry) { /* feed cat */ }
“true” and “false” are reserved words
Initialise as $valid = false;
Compare with ==
AND and OR for combinations
E.g. if($catishungry AND $havefood) {/* feed
cat*/}
17. PHP - IF statement
Used to perform a conditional branch
If (Boolean expression) {
// one or more commands if true
} else {
// one or more commands if false
}
18. PHP - Switch Statements
Useful when a Boolean expression may have
many options E.g.
switch($choice) {
case 0: { /* do things if choice equal 0 */ }
Case 1: {/* do things if choice equal 1 */ }
Case 2: {/* do things if choice equal 2 */ }
Default: {/* do if choice is none of the above */}
}
19. PHP - one small step for man…
… One giant leap for level 1 students
First few steps are crucial - topics covered:
Basic structure and syntax
Variables, constants and operators
Data types and conversions
Decision making
Any questions so far?
20. PHP - Dealing with the Client
All very nice but …
… How is it useful in your web site?
PHP allows you to use HTML forms
Forms require technology at the server to
process them
PHP is a feasible and good choice for the
processing of HTML forms
21. PHP - Dealing with the client
Quick re-cap on forms
Implemented with a <form> element in HTML
Contains other input, text area, list controls
and options
Has some method of submitting
22. PHP - Dealing with the client
Text fields
Checkbox
Radio button
List boxes
Hidden form fields
Password box
Submit and reset buttons
23. PHP - Dealing with the client
<form method=“post” action=“file.php” name=“frmid” >
Method specifies how the data will be sent
Action specifies the file to go to. E.g. file.php
id gives the form a unique name
Post method sends all contents of a form with
basically hidden headers (not easily visible to users)
Get method sends all form input in the URL requested
using name=value pairs separated by ampersands
(&)
E.g. process.php?name=trevor&number=345
Is visible in the URL shown in the browser
24. PHP - Dealing with the client
All form values are placed into an array
Assume a form contains one textbox called
“txtName” and the form is submitted using the post
method, invoking process.php
process.php could access the form data using:
$_POST[‘txtName’]
If the form used the get method, the form data would
be available as:
$_GET[‘txtName’]
25. PHP - Dealing with the client
For example, an HTML form:
<form id=“showmsg” action=“show.php”
method=“post”>
<input type=“text” id=“txtMsg” value=“Hello World” />
<input type=“submit” id=“submit” value=“Submit”>
</form>
26. PHP - Dealing with the client
A file called show.php would receive the
submitted data
It could output the message, for example:
<html>
<head><title>Show Message</title></head>
<body>
<h1><?php echo $_POST[“txtMsg”]; ?></h1>
</body>
</html>
27. PHP - Dealing with the client
Summary
Form elements contain input elements
Each input element has an id
If a form is posted, the file stated as the action
can use:
$_POST[“inputid”]
If a form uses the get method:
$_GET[“inputid”]
Ensure you set all id attributes for form
elements and their contents
28. PHP Introduction - Summary
Topics covered
Server side architecture brief overview
Basic PHP language topics
Syntax
Variables, Constants and Operators
Decision making, IF and Switch statements
Dealing with the client
29. Useful Links and Further
Study
W3 Schools - http://www.w3schools.com/php/
PHP web site - http://www.php.net/
Choi, W. (2000) Beginning PHP4, Wrox Press,
ISBN: 1-861003-73-0
http://www.fcet.staffs.ac.uk/tja1/
Web site will be updated before accompanying tutorial
session
Will contain a useful supplement to tutorial content