SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
PHP – Module 3




        Hussain Fakhruddin
        hussulinux@gmail.com
Agenda


●   PHP HTML Embedding Tags and Syntax
●   Simple PHP Script Example
●   PHP and HTTP Environment Variables
PHP HTML Embedding Tags and
    Syntax


●   HTML is written as <tag>content<tag>
●   Similarly, PHP Tags can be written as:
    <?php method; ?>
    e.g. <?php echo ”Hello World!”; ?>
●   So how does it makes sense?
    - Use different methods to generate contents
    dynamically
    - Call PHP functions and get results at run-
    time
Some other ways to achieve the
same
●   SGML Style (we have already seen!)
    <?php echo ”Hello World!”; ?>
●   ASP / JSP Style
    <% echo “Hello World!”; %>
    OR (Shortcut)
    <p><?=”Hello World!”; ?>
●   (Java)Script Style
    <script language = “php”>
    echo “Hello World!”;
    </script>
Simple PHP Script Example

●   A sample program that illustrates different
    ways to code PHP!
    <html>
    <head><title><? Echo “This is a sample PHP
    page!”; ?></title></head>
    <body>
    <h2>A math example</h2>
    <p>10 + 11 = <%= 10+11 %>
    <br/>and 8 + 9 = <% echo(8+9); %>
    </body>
    </html>
PHP and HTTP Environment
Variables
●   HTTP as a protocol is different, in PHP it has
    rich set of Global / environment variables.
●   They are accessible globally!
●   $HTTP_GET_VARS or $_GET
●   $HTTP_POST_VARS or $_POST
●   $HTTP_COOKIE_VARS or $_COOKIE
●   $HTTP_SERVER_VARS or $_SERVER
●   $HTTP_ENV_VARS or $_ENV
●   $HTTP_POST_FILES
PHP and HTTP Environment
Variables - 1
●   $HTTP_GET_VARS
    &
    $HTTP_POST_VARS
    ●   Mostly used in GET and POST requests
        respectively.
    ●   Contains request information / data.
    ●   Useful in form processing.
PHP and HTTP Environment
Variables - 2
●   $HTTP_COOKIE_VARS
    ●   Cookie is a very small, temporary text file
    ●   A way of session management
    ●   Stored and retrieved user specific information on
        client
PHP and HTTP Environment
Variables - 3
●   $HTTP_SERVER_VARS
    ●   Various information about server
    ●   Examples:
        SERVER_SOFTWARE            “wamp”
        SERVER_NAME                “www.sachinism.com”
        SERVER_PROTOCOL            “HTTP/1.1”
        SERVER_PORT                “80”
        REQUEST_METHOD             “POST”
        QUERY_STRING               “nm=hussu+age=32”
        REMOTE_HOST                “hostname_machine”
        REMOTE_ADDR                “192.168.10.1”
        AUTH_TYPE                  “basic”
        CONTENT_TYPE               “x-url-encoded”
PHP and HTTP Environment
Variables - 4
●   $HTTP_ENV_VARS
    ●   Related to accessing machine and OS specific
        environment variables
●   $HTTP_POST_FILES
    ●   Related to file upload
Summary

●   PHP can be written in either of 3 ways,
    SGML, Script or ASP / JSP styles.
●   PHP environment variables like $_GET,
    $_POST, $_COOKIE, $_SERVER provides
    access to data stored in different ways like
    sent as request, stored as cookies, or some
    data about server.
Whats next?


●   Learning language in dept...
    ●   Variables, Constants and Data Types, and Op-
        erators
    ●   Decision Making, Flow Control and Loops

Más contenido relacionado

La actualidad más candente

Vinay Paudel: Optimizing and Speeding up a WordPress site
Vinay Paudel: Optimizing and Speeding up a WordPress siteVinay Paudel: Optimizing and Speeding up a WordPress site
Vinay Paudel: Optimizing and Speeding up a WordPress site
wpnepal
 
Installation of wordpress
Installation of wordpressInstallation of wordpress
Installation of wordpress
HAINIRMALRAJ
 
Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014
Navaneethan Naveen
 

La actualidad más candente (20)

HTTP fundamentals for developers
HTTP fundamentals for developersHTTP fundamentals for developers
HTTP fundamentals for developers
 
Mule xml parsing
Mule xml parsingMule xml parsing
Mule xml parsing
 
About Http Connection
About Http ConnectionAbout Http Connection
About Http Connection
 
HTTP
HTTPHTTP
HTTP
 
Building Web Services
Building Web ServicesBuilding Web Services
Building Web Services
 
Web (HTTP) request to response life cycle
Web (HTTP) request to response life cycleWeb (HTTP) request to response life cycle
Web (HTTP) request to response life cycle
 
KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7
 
Web technologies: HTTP
Web technologies: HTTPWeb technologies: HTTP
Web technologies: HTTP
 
CakePHP 3
CakePHP 3CakePHP 3
CakePHP 3
 
Introduction To Web (Mukesh Patel)
Introduction To Web (Mukesh Patel)Introduction To Web (Mukesh Patel)
Introduction To Web (Mukesh Patel)
 
Mule xml parsing
Mule xml parsingMule xml parsing
Mule xml parsing
 
HTTP
HTTPHTTP
HTTP
 
Http
HttpHttp
Http
 
An Introduction to HTTP
An Introduction to HTTPAn Introduction to HTTP
An Introduction to HTTP
 
What's up with HTTP?
What's up with HTTP?What's up with HTTP?
What's up with HTTP?
 
HTTP Basics Demo
HTTP Basics DemoHTTP Basics Demo
HTTP Basics Demo
 
Vinay Paudel: Optimizing and Speeding up a WordPress site
Vinay Paudel: Optimizing and Speeding up a WordPress siteVinay Paudel: Optimizing and Speeding up a WordPress site
Vinay Paudel: Optimizing and Speeding up a WordPress site
 
Installation of wordpress
Installation of wordpressInstallation of wordpress
Installation of wordpress
 
Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
 

Similar a PHP MySQL Training : Module 3

Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Muhamad Al Imran
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Muhamad Al Imran
 
nguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-servicenguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-service
hazzaz
 
Lecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdfLecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdf
ShaimaaMohamedGalal
 

Similar a PHP MySQL Training : Module 3 (20)

Coding In Php
Coding In PhpCoding In Php
Coding In Php
 
PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptx
 
PHP Hypertext Preprocessor
PHP Hypertext PreprocessorPHP Hypertext Preprocessor
PHP Hypertext Preprocessor
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Php with my sql
Php with my sqlPhp with my sql
Php with my sql
 
Synapse india reviews on php website development
Synapse india reviews on php website developmentSynapse india reviews on php website development
Synapse india reviews on php website development
 
phpwebdev.ppt
phpwebdev.pptphpwebdev.ppt
phpwebdev.ppt
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
 
Copy of cgi
Copy of cgiCopy of cgi
Copy of cgi
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
Parameter Passing & Session Tracking in PHP
Parameter Passing & Session Tracking in PHPParameter Passing & Session Tracking in PHP
Parameter Passing & Session Tracking in PHP
 
nguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-servicenguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-service
 
Introducation to php for beginners
Introducation to php for beginners Introducation to php for beginners
Introducation to php for beginners
 
Lecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdfLecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdf
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RS
 

Más de hussulinux (7)

Effective communication
Effective communicationEffective communication
Effective communication
 
Enterprise Application Framework
Enterprise Application FrameworkEnterprise Application Framework
Enterprise Application Framework
 
Direct Web Remoting : DWR
Direct Web Remoting : DWRDirect Web Remoting : DWR
Direct Web Remoting : DWR
 
Auto Forex Trade with Meta Trader 4
Auto Forex Trade with Meta Trader 4Auto Forex Trade with Meta Trader 4
Auto Forex Trade with Meta Trader 4
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
Mobile Navigation
Mobile NavigationMobile Navigation
Mobile Navigation
 
Flash Widget Tutorial
Flash Widget TutorialFlash Widget Tutorial
Flash Widget Tutorial
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

PHP MySQL Training : Module 3

  • 1. PHP – Module 3 Hussain Fakhruddin hussulinux@gmail.com
  • 2. Agenda ● PHP HTML Embedding Tags and Syntax ● Simple PHP Script Example ● PHP and HTTP Environment Variables
  • 3. PHP HTML Embedding Tags and Syntax ● HTML is written as <tag>content<tag> ● Similarly, PHP Tags can be written as: <?php method; ?> e.g. <?php echo ”Hello World!”; ?> ● So how does it makes sense? - Use different methods to generate contents dynamically - Call PHP functions and get results at run- time
  • 4. Some other ways to achieve the same ● SGML Style (we have already seen!) <?php echo ”Hello World!”; ?> ● ASP / JSP Style <% echo “Hello World!”; %> OR (Shortcut) <p><?=”Hello World!”; ?> ● (Java)Script Style <script language = “php”> echo “Hello World!”; </script>
  • 5. Simple PHP Script Example ● A sample program that illustrates different ways to code PHP! <html> <head><title><? Echo “This is a sample PHP page!”; ?></title></head> <body> <h2>A math example</h2> <p>10 + 11 = <%= 10+11 %> <br/>and 8 + 9 = <% echo(8+9); %> </body> </html>
  • 6. PHP and HTTP Environment Variables ● HTTP as a protocol is different, in PHP it has rich set of Global / environment variables. ● They are accessible globally! ● $HTTP_GET_VARS or $_GET ● $HTTP_POST_VARS or $_POST ● $HTTP_COOKIE_VARS or $_COOKIE ● $HTTP_SERVER_VARS or $_SERVER ● $HTTP_ENV_VARS or $_ENV ● $HTTP_POST_FILES
  • 7. PHP and HTTP Environment Variables - 1 ● $HTTP_GET_VARS & $HTTP_POST_VARS ● Mostly used in GET and POST requests respectively. ● Contains request information / data. ● Useful in form processing.
  • 8. PHP and HTTP Environment Variables - 2 ● $HTTP_COOKIE_VARS ● Cookie is a very small, temporary text file ● A way of session management ● Stored and retrieved user specific information on client
  • 9. PHP and HTTP Environment Variables - 3 ● $HTTP_SERVER_VARS ● Various information about server ● Examples: SERVER_SOFTWARE “wamp” SERVER_NAME “www.sachinism.com” SERVER_PROTOCOL “HTTP/1.1” SERVER_PORT “80” REQUEST_METHOD “POST” QUERY_STRING “nm=hussu+age=32” REMOTE_HOST “hostname_machine” REMOTE_ADDR “192.168.10.1” AUTH_TYPE “basic” CONTENT_TYPE “x-url-encoded”
  • 10. PHP and HTTP Environment Variables - 4 ● $HTTP_ENV_VARS ● Related to accessing machine and OS specific environment variables ● $HTTP_POST_FILES ● Related to file upload
  • 11. Summary ● PHP can be written in either of 3 ways, SGML, Script or ASP / JSP styles. ● PHP environment variables like $_GET, $_POST, $_COOKIE, $_SERVER provides access to data stored in different ways like sent as request, stored as cookies, or some data about server.
  • 12. Whats next? ● Learning language in dept... ● Variables, Constants and Data Types, and Op- erators ● Decision Making, Flow Control and Loops