Presentation is loading. Please wait.

Presentation is loading. Please wait.

COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.

Similar presentations


Presentation on theme: "COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP."— Presentation transcript:

1 COSC 2328 – Web Programming

2  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP can run on your ‘Create’ instance

3 Web Browsers Web Server Web Server Software (e.g., Apache) www/cosc2328/*.html /*.php /css/*.css /js/*.js PHP Interpreter MySQL Database Web pages rendered here from html, css, images and javascript

4  Name your file with a.php extension  Put the file in your www/cosc2328 folder <?php // PHP code goes here ?>

5 // Many PHP how-to documents show this: <?php print “ Hello World! ”; ?> // For this class, do this instead: <?php print “ \n”. “ Hello World!” \n”. “ \n”. “ ”; ?>

6  PHP superglobals $_GET and $_POST are used to collect form data  When the user fills out the form and clicks the ‘submit’ button, the form data is sent to the PHP file for processing  The form data is sent with an HTTP Post or HTTP Get  You designate whether to use Get or Post in your web page where you define the form

7  Hypertext Transfer protocol (http) is designed to enable communications between clients and servers  http works as a request response protocol between a client and a server  A web browser may be a client and an application on a web server may be the server  Example: A client (browser) submits an http request to a server (web server) and the server does some work and returns a response

8  Can be bookmarked  Remains in browser history  Should never be used with sensitive data  Passes data in the Uniform Resource Locator (URL is a reference address to a resource on the Internet) http://foo.com/bar/baz.php?name1=value1&name2=value2 | Protocol Domain Name | Directory PHP File Name | Name Value Pairs Passed To PHP Script (Query String)

9  Does not remain in browser history  Cannot be bookmarked  Has no restrictions on data length  The query string (name/value pairs) is sent in the http message body of the post request; not in the URL POST /test/demo_form.php HTTP/1.1 Host: foo.com name1=value1&name2=value2

10  http://www.jbryan2.create.stedwards.edu/co sc2328/inClass1.html

11  http://www.w3schools.com/php/


Download ppt "COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP."

Similar presentations


Ads by Google