Slideshare.net (beta)

 
Post to TwitterPost to Twitter
Post: 
Myspace Hi5 Friendster Xanga LiveJournal Facebook Blogger Tagged Typepad Freewebs BlackPlanet gigya icons

All comments

Add a comment on Slide 1

If you have a SlideShare account, login to comment; else you can comment as a guest


Showing 1-50 of 0 (more)

PHP MySQL Training : Module 3

From hussulinux, 7 months ago

PHP HTML Embedding Tags and Syntax<br />Simple PHP Script Example<br />PHP more

478 views  |  0 comments  |  0 favorites  |  38 downloads
 

Categories

Add Category
 
 

Tags

php mysql

 
 

Groups / Events

 

 
Embed
options

More Info

This slideshow is Public
Total Views: 478
on Slideshare: 478
from embeds: 0

Slideshow transcript

Slide 1: PHP – Module 3 Hussain Fakhruddin hussulinux@gmail.com

Slide 2: Agenda ● PHP HTML Embedding Tags and Syntax ● Simple PHP Script Example ● PHP and HTTP Environment Variables

Slide 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

Slide 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>

Slide 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>

Slide 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

Slide 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.

Slide 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

Slide 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”

Slide 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

Slide 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.

Slide 12: Whats next? ● Learning language in dept... ● Variables, Constants and Data Types, and Op- erators ● Decision Making, Flow Control and Loops