SlideShare uma empresa Scribd logo
1 de 12
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante 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
 

Semelhante 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
 

Mais 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

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

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