Scott Marino MSMIS Summer Session 1 - 2001 Web Site Design and Authoring Session 13 Scott Marino.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: The Basics.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
1 PHP Statement Constructs Server Scripting. 5-2 Basic Statement All Statements end in a semicolon. Statements are delimited from the HTML code by enclosing.
PHP Presented by Christine Fang and Ian Stuart ● CS616 Spring 2003.
IST 221 Internet Concepts and Applications Introduction to PHP.
Website Development Introducing PHP The PHP scripting language Syntax derives from C, Java and Perl Open Source Links to MySql database.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
Scripting Languages and PHP. Origins Rasmus Lerdorf ‘Personal Home Pages’. Zeev Surashi and Andi Gutmans Open Source PHP version 4 Full information on.
Guide To UNIX Using Linux Third Edition
Introduction to PHP (Part-1) Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
Server side basics.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
PHP By Dr. Syed Noman Hasany. PHP PHP was originally created by Rasmus Lerdorf in PHP stands for PHP: Hypertext Preprocessor (a recursive acronym).
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
PHP Workshop ‹#› PHP: The Basics. PHP Workshop ‹#› What is it? PHP is a scripting language commonly used on web servers. –Stands for “PHP: Hypertext Preprocessor”
Server Side Scripting Norman White. Where do we do processing? Client side – Javascript (embed code in html) – Java applets (send java program to run.
Introduction to PHP. PHP PHP is the Hypertext Pre-processor –Script language –Embedded into HTML –Runs as Apache module –Can use DB (MySQL, Oracle, Microsoft.
August Chapter 1 - Essential PHP spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
ALBERT WAVERING BOBBY SENG. Week Whatever: PHP  Announcements/questions/complaints.
JSP Standard Tag Library
Copyright © Curt Hill PhP History and Introduction.
CP3024 Lecture 3 Server Side Facilities. Lecture contents  Server side includes  Common gateway interface (CGI)  PHP Hypertext Preprocessor (PHP) pages.
AIT 616 Fall 2002 PHP. AIT 616 Fall 2002 PHP  Special scripting language used to dynamically generate web documents  Open source – Free!!!  Performs.
Languages in WEB Presented by: Jenisha Kshatriya BCM SS09.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 9 Scott Marino.
Nic Shulver, Intro: Developing Server Applications What is a server? Many types of server – File server – file: networked file.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
INTERNET APPLICATION DEVELOPMENT For More visit:
Nic Shulver, Intro: Developing Server Applications What is a server? Many types of server – File server – file: networked file.
Nael Alian Introduction to PHP
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
Introduction to CS520/CS596_026 Lecture Two Gordon Tian Fall 2015.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 5 and 6 Scott Marino.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
PHP. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server.
Introduction to PHP Advanced Database System Lab no.1.
Fall 2004CSI University of Ottawa Introduction to PHP Basic principles and syntax.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
Week 4 PHP H ypertext P reprocessor Reference : Official Site :
Enterprise PHP - Introduction Enterprise Client-Server Development with PHP Nic Shulver, FCES, Staffordshire University A fifteen credit module based on.
CSE 154 LECTURE 5: INTRO TO PHP. URLs and web servers usually when you type a URL in your browser: your computer looks up the.
Introduction to PHP.
IT ELECTIVE 2.  Web server Can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
PHP Workshop ‹#› أطلق إبداعك 2 أطلق إبداعك 2 مدرس معتمد من مركز زووم PHP: The Basics.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Scott Marino MSMIS Kean University MSAS5104 Programming with Data Structures and Algorithms Week 1 Scott Marino.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
CSE 154 LECTURE 14: INTRO TO PHP. URLs and web servers usually when you type a URL in your browser: your computer looks up the.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
Presented By Sushil K. Chaturvedi Assistant Professor SRCEM,Banmore 1.
PHP using MySQL Database for Web Development (part II)
CHAPTER 5 SERVER SIDE SCRIPTING
DBW - PHP DBW2017.
PHP (PHP: Hypertext Preprocessor)
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
PHP Introduction.
PHP.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
PHP: Hypertext Preprocessor
PHP an introduction.
Presentation transcript:

Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 13 Scott Marino

MSMIS Summer Session Topics Introduction to PHP PHP Syntax Forms and Form Elements Numbers and Strings Conditionals and Loops Arrays and Regular Expressions

Scott Marino MSMIS Summer Session Introduction to PHP Originally called Personal Home Page (PHP) Now called Hypertext Preprocessor Created in 1994 as an open source project Server-Side execution Cross Platform compatible –Unix, Windows, Mac, OS/2 HTML embedded

Scott Marino MSMIS Summer Session Why use PHP Better, faster, and easier to learn than CGI, ASP, and JSP PHP does much more than you can do with basic HTML PHP was written specifically to create web pages –Perl, VBScript and Java were adapted to work on the web Can’t do everything that other programming languages can

Scott Marino MSMIS Summer Session Basic Syntax Directive to PHP to interpret the code between the tags and perform the instructions –The phpinfo function prints installation information about PHP –Every instruction ends with a semicolon Files are saved with a.php extension instead of.htm for Apache

Scott Marino MSMIS Summer Session Basic Syntax print(“Hello there”); –Print function to embed text or html into the web page // or # denotes a single line comment /* (several text lines) */ for commenting multiple lines

Scott Marino MSMIS Summer Session Basic Syntax Variable Types –Number –String –Array $num_var = 1; $float_num_var = 1.2; $string_var = “PHP is cool!”; Look at phpinfo(); for available environment variables

Scott Marino MSMIS Summer Session Forms and PHP PHP can access data elements from a form Instead of calling a cgi script in the form action, the action will point to a PHP page Can use both post and get methods (on the form) print(“$lname”); –Prints the PHP variable from the form field name

Scott Marino MSMIS Summer Session Formatting Numbers To print a $ sign, you must “escape” it –print (“total dollars = \$$total_dollars”); The printf(); function can format numbers for printing Supports mathematical precedence with the use of parenthesis Has built in functions like round(); and abs(); Can create random numbers with srand(); and rand();

Scott Marino MSMIS Summer Session String Formatting trim(); removes leading and trailing spaces from string fields –ltrim(); and rtrim(); functions are available $string = $astring. $bstring; $string = $astring. “ “. $bstring; urlencode(); is used to convert characters to the proper format for a url urldecode(); is used to convert an encoded url back to standard format

Scott Marino MSMIS Summer Session String Formatting strtok(); Creates a string from a token –$f_name = strtok($fullname, “ “); substr($string,0,10); –Parses the first 10 characters of the contents of $string starting with position 0 strlen($string); –Counts the number of characters in $string

Scott Marino MSMIS Summer Session Conditionals if (condition) { true action; } else { false action; } If the condition or test results in “true” then execute the “true action” else execute the “false action”

Scott Marino MSMIS Summer Session Conditionals if (condition) { true action; } elseif (condition) { true action; } else { false action; } The elseif allows for additional levels of conditions to be checked

Scott Marino MSMIS Summer Session Conditionals switch ($state) { case "AL": print ("Alabama"); break; ….. default: print(”State of Confusion"); Used for a longer list of conditions than is easily handled with elseif

Scott Marino MSMIS Summer Session Looping while (condition) { statements; } do { statements; } while (condition); for ($I = 1; $I <= somecount; $I++) { statements; }

Scott Marino MSMIS Summer Session Arrays $list = array(“apples”,”peaches”,”pears”); –Creates a simple array with elements in array positions 0,1, and 2 $list = array(1=>“apples”, 2=>”peaches”, 3=>”pears”); –Creates an indexed array with elements in array positions 1, 2, and 3 $list[] = “grapes”; –Adds element “grapes” to the end of the array

Scott Marino MSMIS Summer Session Regular Expressions PHP Supports Regular Expressions ereg(“pattern”,”string”); –ereg is a case sensitive match $pattern = “pattern”; $string = “string”; eregi($pattern, $string); –eregi is a case insensitive match