PHP MySQL Training : Module 3

  • 5,863 views
Uploaded on

PHP HTML Embedding Tags and Syntax …

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

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • IT Pathshala, Noida-Sector-63, offers Guaranteed JOB with PHP Training Programs.

    PAY US ONLY IF YOU GET A JOB!

    CALL US - +91-9871350999 or +91-8800394970

    Technology Centre Address: H-110, Sector-63, Noida (UP)

    Program Takeaways:

    - GUARANTEED JOB in your technology domain
    - Live Major Project development
    - Experience Letter on Training Completion
    - Certification on Training Completion
    - Project Source Code available in CD

    Program Highlights:

    - 100% Guaranteed Job – Don’t pay us if you don’t get a JOB!
    - Industry Ready Courses
    - LIVE International Project Experience
    - Exposure to corporate culture at our IT services facility
    - Networking & Interaction with Industry Experts
    - Training Provided by a reputed IT Company
    - Live Project Source Code made available in CD
    - Technology certification and experience letter at program completion
    - Online Study Content

    CALL US - +91-9871350999 or +91-8800394970

    Our website: www.itpathshala.com
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
5,863
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
215
Comments
1
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 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