SlideShare a Scribd company logo
webdev@rgu
forms and databases in php
PROGRAM INPUTPHP CAN RECEIVE INPUT FROM A NUMBER OF
DIFFERENT SOURCES, EACH HANDLED DIFFERENTLY
• FROM HTTP REQUESTS
• KEY/VALUE PAIRS EMBEDDED IN GET
REQUESTS
• DATA INCLUDED IN THE BODY OF A POST
REQUEST
• FROM RESOURCES
• CONNECTING TO A DATABASE TO RETRIEVE
INFORMATION
using
GET
USING ‘GET’
THE GET KEYWORD ALLOWS US TO RETRIEVE DATA
THAT IS STORED IN THE ADDRESS OF THE WEB PAGE
WWW.MYSITE.COM/RANDOMPAGE.PHP
WWW.MYSITE.COM/RANDOMPAGE.PHP?USERNAME=MIKE
sending variables
RANDOMPAGE.PHP?USERNAME=MIKE&GENDER=MALE
TO USE MORE THAN 1 KEY/VALUE PAIR SEPARATE
THEM WITH AN AMPERSAND
RANDOMPAGE.PHP?USERNAME=MIKE&GENDER=MALE
START WITH A QUESTION MARK
TO USE MORE THAN 1 KEY/VALUE PAIR SEPARATE
THEM WITH AN AMPERSAND
sending variables
RANDOMPAGE.PHP?USERNAME=MIKE&GENDER=MALE
START WITH A QUESTION MARK
VARIABLENAME=VALUE
TO USE MORE THAN 1 KEY/VALUE PAIR SEPARATE
THEM WITH AN AMPERSAND
sending variables
<A HREF=“MYPAGE.PHP?USERNAME=MIKE>CLICK ME</A>
WE CAN USE THIS TO PASS INFORMATION
BETWEEN PAGES
$LOCATION = “MYPAGE.PHP?USERNAME=MIKE”;
HEADER($LOCATION);
IN HTML
IN PHP
THERE WILL BE OTHER WAYS THAT YOU’LL FIND
TO USE THIS AS WELL
sending variables
TAKE THE VARIABLE FROM GET AND ASSIGN IT TO
A STANDARD VARIABLE. YOU CAN THEN USE IT IN
YOUR CODE
using variables
JUST A REMINDER, YOU CAN MAKE YOUR ECHO
STATEMENTS MORE COMPLICATED
CURLY BRACKETS MAKE YOUR LIFE A LOT EASIER,
IT MAY BE WORTH GIVING THEM A GO!
combining in statements
displaying information
using
post
using information from html forms
A SECOND INPUT FOR PHP SCRIPTS IS BY USING
FORMS
• HTML FORMS CAPTURE USER INPUT
• FORM ELEMENTS HAVE NAMES AND WHEN THE
FORM IS SUBMITTED A VALUE IS SET TO THE
CURRENT NAME
• FORM INFORMATION IS ADDED TO
• THE BODY OF THE HTTP REQUEST IF THE FORM
METHOD IS POST
• THE PARAMETERS OF THE HTTP REQUEST IF THE
FORM METHOD IS GET
simpleform.html
HTML FILE CONTAINING A FORM
submitform.php
PHP FILE READING THE FORM INFORMATION
output
using get in forms
WE CAN ALSO USE THE GET METHOD IN THIS
EXAMPLE BUT WE WOULD NEED TO ALTER
SIMPLEFORM.HTML AND SUBMITFORM.PHP IN
ORDER TO DO THIS
• THERE ARE LIMITATIONS TO HOW MUCH
INFORMATION CAN BE ENCODED IN A URL STRING
• THIS IS BROWSER SPECIFIC
• SECURITY CONCERNS ALSO EXIST BECAUSE THE
HTTP HEADER IS EXPOSE AND CAN BE INSPECTED
BY THIRD PARTIES
• USING POST MAKES THIS EASIER TO PROTECT
linking your form to a
database
using a database
ONE OF THE MOST COMMON TASKS THAT YOU
WILL WANT TO DO WITH A WEB FORM IS STORE
THE INFORMATION IN A DATABASE
• COVERED THIS LAST WEEK BUT IT IS WORTH
GOING OVER AGAIN
simpleform.html
WE WILL USE THE SAME FORM AS BEFORE
submitform.php
submitform.php
• CONNECT TO THE DATABASE
submitform.php
• CONNECT TO THE DATABASE
• OBTAIN THE $POST VARIABLES
submitform.php
• CONNECT TO THE DATABASE
• OBTAIN THE $POST VARIABLES
• FORM THE SQL QUERY
submitform.php
• CONNECT TO THE DATABASE
• OBTAIN THE $POST VARIABLES
• FORM THE SQL QUERY
• RUN THE SQL QUERY
submitform.php
• CONNECT TO THE DATABASE
• OBTAIN THE $POST VARIABLES
• FORM THE SQL QUERY
• RUN THE SQL QUERY
• REDIRECT TO ANOTHER PAGE
viewusers.php
CONNECT TO THE DATABASE
CONNECT TO THE DATABASE
PUT IN THE HTML HEADERS
viewusers.php
CONNECT TO THE DATABASE
PUT IN THE HTML HEADERS
START AN UNORDERED LIST
viewusers.php
CONNECT TO THE DATABASE
PUT IN THE HTML HEADERS
START AN UNORDERED LIST
OPEN UP THE PHP TAGS
viewusers.php
CONNECT TO THE DATABASE
PUT IN THE HTML HEADERS
START AN UNORDERED LIST
OPEN UP THE PHP TAGS
WRITE THE SQL QUERY
viewusers.php
CONNECT TO THE DATABASE
PUT IN THE HTML HEADERS
START AN UNORDERED LIST
OPEN UP THE PHP TAGS
WRITE THE SQL QUERY
RUN THE QUERY
viewusers.php
CONNECT TO THE DATABASE
PUT IN THE HTML HEADERS
START AN UNORDERED LIST
OPEN UP THE PHP TAGS
WRITE THE SQL QUERY
RUN THE QUERY
USE THE WHILE LOOP TO OF THROUGH IT
viewusers.php
CONNECT TO THE DATABASE
PUT IN THE HTML HEADERS
START AN UNORDERED LIST
OPEN UP THE PHP TAGS
WRITE THE SQL QUERY
RUN THE QUERY
USE THE WHILE LOOP TO OF THROUGH IT
• FOR ROW THAT EXISTS
viewusers.php
CONNECT TO THE DATABASE
PUT IN THE HTML HEADERS
START AN UNORDERED LIST
OPEN UP THE PHP TAGS
WRITE THE SQL QUERY
RUN THE QUERY
USE THE WHILE LOOP TO OF THROUGH IT
• FOR ROW THAT EXISTS
• TURN THE $ROW VARIABLES INTO NORMAL VARIABLES
viewusers.php
CONNECT TO THE DATABASE
PUT IN THE HTML HEADERS
START AN UNORDERED LIST
OPEN UP THE PHP TAGS
WRITE THE SQL QUERY
RUN THE QUERY
USE THE WHILE LOOP TO OF THROUGH IT
• FOR ROW THAT EXISTS
• TURN THE $ROW VARIABLES INTO NORMAL VARIABLES
• ECHO THEM OUT
viewusers.php
output

More Related Content

What's hot

Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1
Gheyath M. Othman
 
HTML/CSS/java Script/Jquery
HTML/CSS/java Script/JqueryHTML/CSS/java Script/Jquery
HTML/CSS/java Script/Jquery
FAKHRUN NISHA
 
HTML Link - Image - Comments
HTML  Link - Image - CommentsHTML  Link - Image - Comments
HTML Link - Image - Comments
Hameda Hurmat
 
Html and Xhtml
Html and XhtmlHtml and Xhtml
Html and Xhtml
Chhom Karath
 
Origins and evolution of HTML and XHTML
Origins and evolution of HTML and XHTMLOrigins and evolution of HTML and XHTML
Origins and evolution of HTML and XHTML
Howpk
 
Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2
Gheyath M. Othman
 
HTML Web design english & sinhala mix note
HTML Web design english & sinhala mix noteHTML Web design english & sinhala mix note
HTML Web design english & sinhala mix note
Mahinda Gamage
 
DIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web DesigningDIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web Designing
Rasan Samarasinghe
 
HTML Foundations, pt 2
HTML Foundations, pt 2HTML Foundations, pt 2
HTML Foundations, pt 2
Shawn Calvert
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
Shawn Calvert
 
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
Michaela Lehr
 
Html,javascript & css
Html,javascript & cssHtml,javascript & css
Html,javascript & css
Predhin Sapru
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
 
HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1
Sanjeev Kumar
 
HTML Lecture Part 1 of 2
HTML Lecture Part 1 of 2HTML Lecture Part 1 of 2
HTML Lecture Part 1 of 2
Sharon Wasden
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
Sanjeev Kumar
 
HTML 5 Complete Reference
HTML 5 Complete ReferenceHTML 5 Complete Reference
HTML 5 Complete Reference
EPAM Systems
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
Dave Kelly
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4
Gheyath M. Othman
 

What's hot (20)

Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1
 
HTML/CSS/java Script/Jquery
HTML/CSS/java Script/JqueryHTML/CSS/java Script/Jquery
HTML/CSS/java Script/Jquery
 
Web page concept final ppt
Web page concept  final pptWeb page concept  final ppt
Web page concept final ppt
 
HTML Link - Image - Comments
HTML  Link - Image - CommentsHTML  Link - Image - Comments
HTML Link - Image - Comments
 
Html and Xhtml
Html and XhtmlHtml and Xhtml
Html and Xhtml
 
Origins and evolution of HTML and XHTML
Origins and evolution of HTML and XHTMLOrigins and evolution of HTML and XHTML
Origins and evolution of HTML and XHTML
 
Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2
 
HTML Web design english & sinhala mix note
HTML Web design english & sinhala mix noteHTML Web design english & sinhala mix note
HTML Web design english & sinhala mix note
 
DIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web DesigningDIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web Designing
 
HTML Foundations, pt 2
HTML Foundations, pt 2HTML Foundations, pt 2
HTML Foundations, pt 2
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
 
Html,javascript & css
Html,javascript & cssHtml,javascript & css
Html,javascript & css
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1
 
HTML Lecture Part 1 of 2
HTML Lecture Part 1 of 2HTML Lecture Part 1 of 2
HTML Lecture Part 1 of 2
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
HTML 5 Complete Reference
HTML 5 Complete ReferenceHTML 5 Complete Reference
HTML 5 Complete Reference
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4
 

Viewers also liked

Php forms
Php formsPhp forms
Php forms
Anne Lee
 
Using arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing informationUsing arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing information
Nicole Ryan
 
03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lforms
IIUM
 
PHP Forms PHP 05
PHP Forms PHP 05PHP Forms PHP 05
PHP Forms PHP 05
Spy Seat
 
Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5Michael Girouard
 
7 4 Preparing The Elements Forms And Databases
7 4 Preparing The Elements Forms And Databases7 4 Preparing The Elements Forms And Databases
7 4 Preparing The Elements Forms And DatabasesStark State College
 
CMS 130: Web Forms
CMS 130: Web FormsCMS 130: Web Forms
CMS 130: Web Forms
Montana State University
 
Website maintenance: keeping your WordPress site updated and safe
Website maintenance: keeping your WordPress site updated and safeWebsite maintenance: keeping your WordPress site updated and safe
Website maintenance: keeping your WordPress site updated and safe
Clare Parkinson
 
Good and bad examples of e-commerce websites
Good and bad examples of e-commerce websitesGood and bad examples of e-commerce websites
Good and bad examples of e-commerce websitesseng
 
Financial intelligent for start ups
Financial intelligent for start upsFinancial intelligent for start ups
Financial intelligent for start upsjubril
 
Presentation & Pitching tips
Presentation & Pitching tipsPresentation & Pitching tips
Presentation & Pitching tips
ABrandNewYou
 
Using mySQL in PHP
Using mySQL in PHPUsing mySQL in PHP
Using mySQL in PHP
Mike Crabb
 
Microsoft excel beginner
Microsoft excel beginnerMicrosoft excel beginner
Microsoft excel beginner
denstar ricardo silalahi
 
Intro to php
Intro to phpIntro to php
Intro to php
Sp Singh
 
Why Learn PHP Programming?
Why Learn PHP Programming?Why Learn PHP Programming?
Why Learn PHP Programming?
XtreemHeights
 
How to Use Publicity to Grow Your Startup
How to Use Publicity to Grow Your StartupHow to Use Publicity to Grow Your Startup
How to Use Publicity to Grow Your Startup
Joy Schoffler
 

Viewers also liked (20)

Php forms
Php formsPhp forms
Php forms
 
Using arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing informationUsing arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing information
 
03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lforms
 
PHP Forms PHP 05
PHP Forms PHP 05PHP Forms PHP 05
PHP Forms PHP 05
 
Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5
 
Website Hosting Guide
Website Hosting GuideWebsite Hosting Guide
Website Hosting Guide
 
7 4 Preparing The Elements Forms And Databases
7 4 Preparing The Elements Forms And Databases7 4 Preparing The Elements Forms And Databases
7 4 Preparing The Elements Forms And Databases
 
CMS 130: Web Forms
CMS 130: Web FormsCMS 130: Web Forms
CMS 130: Web Forms
 
Blog12: Google Form (Database)
Blog12: Google Form (Database)Blog12: Google Form (Database)
Blog12: Google Form (Database)
 
Website maintenance: keeping your WordPress site updated and safe
Website maintenance: keeping your WordPress site updated and safeWebsite maintenance: keeping your WordPress site updated and safe
Website maintenance: keeping your WordPress site updated and safe
 
Good and bad examples of e-commerce websites
Good and bad examples of e-commerce websitesGood and bad examples of e-commerce websites
Good and bad examples of e-commerce websites
 
Financial intelligent for start ups
Financial intelligent for start upsFinancial intelligent for start ups
Financial intelligent for start ups
 
Fcp lecture 01
Fcp lecture 01Fcp lecture 01
Fcp lecture 01
 
JQuery-Tutorial
 JQuery-Tutorial JQuery-Tutorial
JQuery-Tutorial
 
Presentation & Pitching tips
Presentation & Pitching tipsPresentation & Pitching tips
Presentation & Pitching tips
 
Using mySQL in PHP
Using mySQL in PHPUsing mySQL in PHP
Using mySQL in PHP
 
Microsoft excel beginner
Microsoft excel beginnerMicrosoft excel beginner
Microsoft excel beginner
 
Intro to php
Intro to phpIntro to php
Intro to php
 
Why Learn PHP Programming?
Why Learn PHP Programming?Why Learn PHP Programming?
Why Learn PHP Programming?
 
How to Use Publicity to Grow Your Startup
How to Use Publicity to Grow Your StartupHow to Use Publicity to Grow Your Startup
How to Use Publicity to Grow Your Startup
 

Similar to Forms and Databases in PHP

Restful web services
Restful web servicesRestful web services
Restful web services
Surinder Mehra
 
HTTP Basics Demo
HTTP Basics DemoHTTP Basics Demo
HTTP Basics Demo
InMobi Technology
 
Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIs
amesar0
 
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
Martijn Dashorst
 
PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
Ahmed Saihood
 
POSTMAN.pptx
POSTMAN.pptxPOSTMAN.pptx
POSTMAN.pptx
RamaKrishna970827
 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptx
ShitalGhotekar
 
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Nguyen Duc Phu
 
EST is a software architectural style that was created to guide the design an...
EST is a software architectural style that was created to guide the design an...EST is a software architectural style that was created to guide the design an...
EST is a software architectural style that was created to guide the design an...
michaelaaron25322
 
HTTPs Strict Transport Security
HTTPs    Strict Transport Security HTTPs    Strict Transport Security
HTTPs Strict Transport Security
Gol D Roger
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service DesignLorna Mitchell
 
Php workshop L03 superglobals
Php workshop L03 superglobalsPhp workshop L03 superglobals
Php workshop L03 superglobals
Mohammad Tahsin Alshalabi
 
Design API using RAML - basics
Design API using RAML - basicsDesign API using RAML - basics
Design API using RAML - basics
kunal vishe
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
Lorna Mitchell
 
The Top Tips You need to Learn about Data in your Mobile App
The Top Tips You need to Learn about Data in your Mobile AppThe Top Tips You need to Learn about Data in your Mobile App
The Top Tips You need to Learn about Data in your Mobile App
Woodruff Solutions LLC
 
RESTful for opentravel.org by HP
RESTful for opentravel.org by HPRESTful for opentravel.org by HP
RESTful for opentravel.org by HP
Roni Schuetz
 
Web-01-HTTP.pptx
Web-01-HTTP.pptxWeb-01-HTTP.pptx
Web-01-HTTP.pptx
AliZaib71
 
introduction_php.ppt
introduction_php.pptintroduction_php.ppt
introduction_php.ppt
ArunKumar313658
 
10_introduction_php.ppt
10_introduction_php.ppt10_introduction_php.ppt
10_introduction_php.ppt
MercyL2
 

Similar to Forms and Databases in PHP (20)

Restful web services
Restful web servicesRestful web services
Restful web services
 
HTTP Basics Demo
HTTP Basics DemoHTTP Basics Demo
HTTP Basics Demo
 
Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIs
 
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
 
PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
 
POSTMAN.pptx
POSTMAN.pptxPOSTMAN.pptx
POSTMAN.pptx
 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptx
 
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
 
EST is a software architectural style that was created to guide the design an...
EST is a software architectural style that was created to guide the design an...EST is a software architectural style that was created to guide the design an...
EST is a software architectural style that was created to guide the design an...
 
HTTPs Strict Transport Security
HTTPs    Strict Transport Security HTTPs    Strict Transport Security
HTTPs Strict Transport Security
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service Design
 
Php workshop L03 superglobals
Php workshop L03 superglobalsPhp workshop L03 superglobals
Php workshop L03 superglobals
 
Design API using RAML - basics
Design API using RAML - basicsDesign API using RAML - basics
Design API using RAML - basics
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
The Top Tips You need to Learn about Data in your Mobile App
The Top Tips You need to Learn about Data in your Mobile AppThe Top Tips You need to Learn about Data in your Mobile App
The Top Tips You need to Learn about Data in your Mobile App
 
RESTful for opentravel.org by HP
RESTful for opentravel.org by HPRESTful for opentravel.org by HP
RESTful for opentravel.org by HP
 
Restful web services
Restful web servicesRestful web services
Restful web services
 
Web-01-HTTP.pptx
Web-01-HTTP.pptxWeb-01-HTTP.pptx
Web-01-HTTP.pptx
 
introduction_php.ppt
introduction_php.pptintroduction_php.ppt
introduction_php.ppt
 
10_introduction_php.ppt
10_introduction_php.ppt10_introduction_php.ppt
10_introduction_php.ppt
 

More from Mike Crabb

Hard to Reach Users in Easy to Reach Places
Hard to Reach Users in Easy to Reach PlacesHard to Reach Users in Easy to Reach Places
Hard to Reach Users in Easy to Reach Places
Mike Crabb
 
Accessible and Assistive Interfaces
Accessible and Assistive InterfacesAccessible and Assistive Interfaces
Accessible and Assistive Interfaces
Mike Crabb
 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible Everyone
Mike Crabb
 
The Peer Review Process
The Peer Review ProcessThe Peer Review Process
The Peer Review Process
Mike Crabb
 
Managing Quality In Qualitative Research
Managing Quality In Qualitative ResearchManaging Quality In Qualitative Research
Managing Quality In Qualitative Research
Mike Crabb
 
Analysing Qualitative Data
Analysing Qualitative DataAnalysing Qualitative Data
Analysing Qualitative Data
Mike Crabb
 
Conversation Discourse and Document Analysis
Conversation Discourse and Document AnalysisConversation Discourse and Document Analysis
Conversation Discourse and Document Analysis
Mike Crabb
 
Ethnographic and Observational Research
Ethnographic and Observational ResearchEthnographic and Observational Research
Ethnographic and Observational Research
Mike Crabb
 
Doing Focus Groups
Doing Focus GroupsDoing Focus Groups
Doing Focus Groups
Mike Crabb
 
Doing Interviews
Doing InterviewsDoing Interviews
Doing Interviews
Mike Crabb
 
Designing Qualitative Research
Designing Qualitative ResearchDesigning Qualitative Research
Designing Qualitative Research
Mike Crabb
 
Introduction to Accessible Design
Introduction to Accessible DesignIntroduction to Accessible Design
Introduction to Accessible Design
Mike Crabb
 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible Everyone
Mike Crabb
 
Texture and Glyph Design
Texture and Glyph DesignTexture and Glyph Design
Texture and Glyph Design
Mike Crabb
 
Pattern Perception and Map Design
Pattern Perception and Map DesignPattern Perception and Map Design
Pattern Perception and Map Design
Mike Crabb
 
Dealing with Enterprise Level Data
Dealing with Enterprise Level DataDealing with Enterprise Level Data
Dealing with Enterprise Level Data
Mike Crabb
 
Using Cloud in an Enterprise Environment
Using Cloud in an Enterprise EnvironmentUsing Cloud in an Enterprise Environment
Using Cloud in an Enterprise Environment
Mike Crabb
 
Teaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of TomorrowTeaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of Tomorrow
Mike Crabb
 
Sql Injection and XSS
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSS
Mike Crabb
 
Creating a Webpage from a Template
Creating a Webpage from a TemplateCreating a Webpage from a Template
Creating a Webpage from a Template
Mike Crabb
 

More from Mike Crabb (20)

Hard to Reach Users in Easy to Reach Places
Hard to Reach Users in Easy to Reach PlacesHard to Reach Users in Easy to Reach Places
Hard to Reach Users in Easy to Reach Places
 
Accessible and Assistive Interfaces
Accessible and Assistive InterfacesAccessible and Assistive Interfaces
Accessible and Assistive Interfaces
 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible Everyone
 
The Peer Review Process
The Peer Review ProcessThe Peer Review Process
The Peer Review Process
 
Managing Quality In Qualitative Research
Managing Quality In Qualitative ResearchManaging Quality In Qualitative Research
Managing Quality In Qualitative Research
 
Analysing Qualitative Data
Analysing Qualitative DataAnalysing Qualitative Data
Analysing Qualitative Data
 
Conversation Discourse and Document Analysis
Conversation Discourse and Document AnalysisConversation Discourse and Document Analysis
Conversation Discourse and Document Analysis
 
Ethnographic and Observational Research
Ethnographic and Observational ResearchEthnographic and Observational Research
Ethnographic and Observational Research
 
Doing Focus Groups
Doing Focus GroupsDoing Focus Groups
Doing Focus Groups
 
Doing Interviews
Doing InterviewsDoing Interviews
Doing Interviews
 
Designing Qualitative Research
Designing Qualitative ResearchDesigning Qualitative Research
Designing Qualitative Research
 
Introduction to Accessible Design
Introduction to Accessible DesignIntroduction to Accessible Design
Introduction to Accessible Design
 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible Everyone
 
Texture and Glyph Design
Texture and Glyph DesignTexture and Glyph Design
Texture and Glyph Design
 
Pattern Perception and Map Design
Pattern Perception and Map DesignPattern Perception and Map Design
Pattern Perception and Map Design
 
Dealing with Enterprise Level Data
Dealing with Enterprise Level DataDealing with Enterprise Level Data
Dealing with Enterprise Level Data
 
Using Cloud in an Enterprise Environment
Using Cloud in an Enterprise EnvironmentUsing Cloud in an Enterprise Environment
Using Cloud in an Enterprise Environment
 
Teaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of TomorrowTeaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of Tomorrow
 
Sql Injection and XSS
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSS
 
Creating a Webpage from a Template
Creating a Webpage from a TemplateCreating a Webpage from a Template
Creating a Webpage from a Template
 

Recently uploaded

Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 

Recently uploaded (20)

Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 

Forms and Databases in PHP

  • 2. PROGRAM INPUTPHP CAN RECEIVE INPUT FROM A NUMBER OF DIFFERENT SOURCES, EACH HANDLED DIFFERENTLY • FROM HTTP REQUESTS • KEY/VALUE PAIRS EMBEDDED IN GET REQUESTS • DATA INCLUDED IN THE BODY OF A POST REQUEST • FROM RESOURCES • CONNECTING TO A DATABASE TO RETRIEVE INFORMATION
  • 4. USING ‘GET’ THE GET KEYWORD ALLOWS US TO RETRIEVE DATA THAT IS STORED IN THE ADDRESS OF THE WEB PAGE WWW.MYSITE.COM/RANDOMPAGE.PHP WWW.MYSITE.COM/RANDOMPAGE.PHP?USERNAME=MIKE
  • 5. sending variables RANDOMPAGE.PHP?USERNAME=MIKE&GENDER=MALE TO USE MORE THAN 1 KEY/VALUE PAIR SEPARATE THEM WITH AN AMPERSAND
  • 6. RANDOMPAGE.PHP?USERNAME=MIKE&GENDER=MALE START WITH A QUESTION MARK TO USE MORE THAN 1 KEY/VALUE PAIR SEPARATE THEM WITH AN AMPERSAND sending variables
  • 7. RANDOMPAGE.PHP?USERNAME=MIKE&GENDER=MALE START WITH A QUESTION MARK VARIABLENAME=VALUE TO USE MORE THAN 1 KEY/VALUE PAIR SEPARATE THEM WITH AN AMPERSAND sending variables
  • 8. <A HREF=“MYPAGE.PHP?USERNAME=MIKE>CLICK ME</A> WE CAN USE THIS TO PASS INFORMATION BETWEEN PAGES $LOCATION = “MYPAGE.PHP?USERNAME=MIKE”; HEADER($LOCATION); IN HTML IN PHP THERE WILL BE OTHER WAYS THAT YOU’LL FIND TO USE THIS AS WELL sending variables
  • 9. TAKE THE VARIABLE FROM GET AND ASSIGN IT TO A STANDARD VARIABLE. YOU CAN THEN USE IT IN YOUR CODE using variables
  • 10. JUST A REMINDER, YOU CAN MAKE YOUR ECHO STATEMENTS MORE COMPLICATED CURLY BRACKETS MAKE YOUR LIFE A LOT EASIER, IT MAY BE WORTH GIVING THEM A GO! combining in statements
  • 13. using information from html forms A SECOND INPUT FOR PHP SCRIPTS IS BY USING FORMS • HTML FORMS CAPTURE USER INPUT • FORM ELEMENTS HAVE NAMES AND WHEN THE FORM IS SUBMITTED A VALUE IS SET TO THE CURRENT NAME • FORM INFORMATION IS ADDED TO • THE BODY OF THE HTTP REQUEST IF THE FORM METHOD IS POST • THE PARAMETERS OF THE HTTP REQUEST IF THE FORM METHOD IS GET
  • 15. submitform.php PHP FILE READING THE FORM INFORMATION
  • 17. using get in forms WE CAN ALSO USE THE GET METHOD IN THIS EXAMPLE BUT WE WOULD NEED TO ALTER SIMPLEFORM.HTML AND SUBMITFORM.PHP IN ORDER TO DO THIS • THERE ARE LIMITATIONS TO HOW MUCH INFORMATION CAN BE ENCODED IN A URL STRING • THIS IS BROWSER SPECIFIC • SECURITY CONCERNS ALSO EXIST BECAUSE THE HTTP HEADER IS EXPOSE AND CAN BE INSPECTED BY THIRD PARTIES • USING POST MAKES THIS EASIER TO PROTECT
  • 18. linking your form to a database
  • 19. using a database ONE OF THE MOST COMMON TASKS THAT YOU WILL WANT TO DO WITH A WEB FORM IS STORE THE INFORMATION IN A DATABASE • COVERED THIS LAST WEEK BUT IT IS WORTH GOING OVER AGAIN
  • 20. simpleform.html WE WILL USE THE SAME FORM AS BEFORE
  • 23. submitform.php • CONNECT TO THE DATABASE • OBTAIN THE $POST VARIABLES
  • 24. submitform.php • CONNECT TO THE DATABASE • OBTAIN THE $POST VARIABLES • FORM THE SQL QUERY
  • 25. submitform.php • CONNECT TO THE DATABASE • OBTAIN THE $POST VARIABLES • FORM THE SQL QUERY • RUN THE SQL QUERY
  • 26. submitform.php • CONNECT TO THE DATABASE • OBTAIN THE $POST VARIABLES • FORM THE SQL QUERY • RUN THE SQL QUERY • REDIRECT TO ANOTHER PAGE
  • 28. CONNECT TO THE DATABASE PUT IN THE HTML HEADERS viewusers.php
  • 29. CONNECT TO THE DATABASE PUT IN THE HTML HEADERS START AN UNORDERED LIST viewusers.php
  • 30. CONNECT TO THE DATABASE PUT IN THE HTML HEADERS START AN UNORDERED LIST OPEN UP THE PHP TAGS viewusers.php
  • 31. CONNECT TO THE DATABASE PUT IN THE HTML HEADERS START AN UNORDERED LIST OPEN UP THE PHP TAGS WRITE THE SQL QUERY viewusers.php
  • 32. CONNECT TO THE DATABASE PUT IN THE HTML HEADERS START AN UNORDERED LIST OPEN UP THE PHP TAGS WRITE THE SQL QUERY RUN THE QUERY viewusers.php
  • 33. CONNECT TO THE DATABASE PUT IN THE HTML HEADERS START AN UNORDERED LIST OPEN UP THE PHP TAGS WRITE THE SQL QUERY RUN THE QUERY USE THE WHILE LOOP TO OF THROUGH IT viewusers.php
  • 34. CONNECT TO THE DATABASE PUT IN THE HTML HEADERS START AN UNORDERED LIST OPEN UP THE PHP TAGS WRITE THE SQL QUERY RUN THE QUERY USE THE WHILE LOOP TO OF THROUGH IT • FOR ROW THAT EXISTS viewusers.php
  • 35. CONNECT TO THE DATABASE PUT IN THE HTML HEADERS START AN UNORDERED LIST OPEN UP THE PHP TAGS WRITE THE SQL QUERY RUN THE QUERY USE THE WHILE LOOP TO OF THROUGH IT • FOR ROW THAT EXISTS • TURN THE $ROW VARIABLES INTO NORMAL VARIABLES viewusers.php
  • 36. CONNECT TO THE DATABASE PUT IN THE HTML HEADERS START AN UNORDERED LIST OPEN UP THE PHP TAGS WRITE THE SQL QUERY RUN THE QUERY USE THE WHILE LOOP TO OF THROUGH IT • FOR ROW THAT EXISTS • TURN THE $ROW VARIABLES INTO NORMAL VARIABLES • ECHO THEM OUT viewusers.php