SlideShare a Scribd company logo
1 of 37
Download to read offline
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 1Gheyath M. Othman
 
HTML/CSS/java Script/Jquery
HTML/CSS/java Script/JqueryHTML/CSS/java Script/Jquery
HTML/CSS/java Script/JqueryFAKHRUN NISHA
 
HTML Link - Image - Comments
HTML  Link - Image - CommentsHTML  Link - Image - Comments
HTML Link - Image - CommentsHameda Hurmat
 
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 XHTMLHowpk
 
Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2Gheyath 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 noteMahinda 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 DesigningRasan Samarasinghe
 
HTML Foundations, pt 2
HTML Foundations, pt 2HTML Foundations, pt 2
HTML Foundations, pt 2Shawn Calvert
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS PresentationShawn 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 & cssPredhin Sapru
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basicsEliran Eliassy
 
HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1Sanjeev Kumar
 
HTML Lecture Part 1 of 2
HTML Lecture Part 1 of 2HTML Lecture Part 1 of 2
HTML Lecture Part 1 of 2Sharon Wasden
 
HTML 5 Complete Reference
HTML 5 Complete ReferenceHTML 5 Complete Reference
HTML 5 Complete ReferenceEPAM 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 4Gheyath 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

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 informationNicole Ryan
 
03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lformsIIUM
 
PHP Forms PHP 05
PHP Forms PHP 05PHP Forms PHP 05
PHP Forms PHP 05Spy 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
 
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 safeClare 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 tipsABrandNewYou
 
Using mySQL in PHP
Using mySQL in PHPUsing mySQL in PHP
Using mySQL in PHPMike Crabb
 
Intro to php
Intro to phpIntro to php
Intro to phpSp 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 StartupJoy 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

Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIsamesar0
 
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.0Martijn Dashorst
 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxShitalGhotekar
 
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
 
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
 
Design API using RAML - basics
Design API using RAML - basicsDesign API using RAML - basics
Design API using RAML - basicskunal vishe
 
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 AppWoodruff Solutions LLC
 
RESTful for opentravel.org by HP
RESTful for opentravel.org by HPRESTful for opentravel.org by HP
RESTful for opentravel.org by HPRoni Schuetz
 
Web-01-HTTP.pptx
Web-01-HTTP.pptxWeb-01-HTTP.pptx
Web-01-HTTP.pptxAliZaib71
 
10_introduction_php.ppt
10_introduction_php.ppt10_introduction_php.ppt
10_introduction_php.pptMercyL2
 
10_introduction_php.ppt
10_introduction_php.ppt10_introduction_php.ppt
10_introduction_php.pptGiyaShefin
 

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...
 
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
 
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 PlacesMike Crabb
 
Accessible and Assistive Interfaces
Accessible and Assistive InterfacesAccessible and Assistive Interfaces
Accessible and Assistive InterfacesMike Crabb
 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible EveryoneMike Crabb
 
The Peer Review Process
The Peer Review ProcessThe Peer Review Process
The Peer Review ProcessMike Crabb
 
Managing Quality In Qualitative Research
Managing Quality In Qualitative ResearchManaging Quality In Qualitative Research
Managing Quality In Qualitative ResearchMike Crabb
 
Analysing Qualitative Data
Analysing Qualitative DataAnalysing Qualitative Data
Analysing Qualitative DataMike Crabb
 
Conversation Discourse and Document Analysis
Conversation Discourse and Document AnalysisConversation Discourse and Document Analysis
Conversation Discourse and Document AnalysisMike Crabb
 
Ethnographic and Observational Research
Ethnographic and Observational ResearchEthnographic and Observational Research
Ethnographic and Observational ResearchMike Crabb
 
Doing Focus Groups
Doing Focus GroupsDoing Focus Groups
Doing Focus GroupsMike Crabb
 
Doing Interviews
Doing InterviewsDoing Interviews
Doing InterviewsMike Crabb
 
Designing Qualitative Research
Designing Qualitative ResearchDesigning Qualitative Research
Designing Qualitative ResearchMike Crabb
 
Introduction to Accessible Design
Introduction to Accessible DesignIntroduction to Accessible Design
Introduction to Accessible DesignMike Crabb
 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible EveryoneMike Crabb
 
Texture and Glyph Design
Texture and Glyph DesignTexture and Glyph Design
Texture and Glyph DesignMike Crabb
 
Pattern Perception and Map Design
Pattern Perception and Map DesignPattern Perception and Map Design
Pattern Perception and Map DesignMike Crabb
 
Dealing with Enterprise Level Data
Dealing with Enterprise Level DataDealing with Enterprise Level Data
Dealing with Enterprise Level DataMike Crabb
 
Using Cloud in an Enterprise Environment
Using Cloud in an Enterprise EnvironmentUsing Cloud in an Enterprise Environment
Using Cloud in an Enterprise EnvironmentMike 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 TomorrowMike Crabb
 
Sql Injection and XSS
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSSMike Crabb
 
Creating a Webpage from a Template
Creating a Webpage from a TemplateCreating a Webpage from a Template
Creating a Webpage from a TemplateMike 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

Introduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptxIntroduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptxIntelliSource Technologies
 
Kawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorShane Coughlan
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIIvo Andreev
 
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageSales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageDista
 
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfTobias Schneck
 
Webinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptWebinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptkinjal48
 
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.Sharon Liu
 
Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesSoftwareMill
 
eAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionseAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionsNirav Modi
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Jaydeep Chhasatia
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilVICTOR MAESTRE RAMIREZ
 
AI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyAI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyRaymond Okyere-Forson
 
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...OnePlan Solutions
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesShyamsundar Das
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampVICTOR MAESTRE RAMIREZ
 
Enterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze IncEnterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze Incrobinwilliams8624
 
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsYour Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsJaydeep Chhasatia
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdfMeon Technology
 

Recently uploaded (20)

Introduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptxIntroduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptx
 
Kawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in Trivandrum
 
Salesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptxSalesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptx
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS Calculator
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AI
 
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageSales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
 
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
 
Webinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptWebinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.ppt
 
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
 
Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retries
 
eAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionseAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspections
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-Council
 
AI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyAI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human Beauty
 
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security Challenges
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - Datacamp
 
Enterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze IncEnterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze Inc
 
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsYour Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdf
 

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