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 (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
 
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
 
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 (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)
 
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)
 
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

Último (20)

AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 

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