PHP MOHAMMED SHURRAB TO MISS/ RASHA ATTALLAH. What is PHP? Stands for "PHP Hypertext Preprocessor" Server-side scripting language HTML-embedded Supports.

Slides:



Advertisements
Similar presentations
PHP Hypertext Preprocessor Information Systems 337 Prof. Harry Plantinga.
Advertisements

1 Database Driven Web Application Clients Application Servers including web servers Database Server Traditional client-server (2-tier architecture): client:
IST 221 Internet Concepts and Applications Introduction to PHP.
PHP Intro/Overview Squirrel Book pages Server-side Scripting Everything you need to know in one slide 1.Web server (with PHP “plug-in”) gets a.
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
CST JavaScript Validating Form Data with JavaScript.
PHP: Introduction By Trevor Adams.
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.
PHP Overview CS PHP PHP = PHP: Hypertext Preprocessor Server-side scripting language that may be embedded into HTML One goal is to get PHP files.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
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.
INTERNET APPLICATION DEVELOPMENT For More visit:
Lecture 12 PHP Basics Boriana Koleva Room: C54
Chapter 5 Java Script And Forms JavaScript, Third Edition.
University of Sunderland Lecture 1 Internet Software Architectures Lecture 1: Introduction.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
School of Computing and Information Systems CS 371 Web Application Programming PHP - Basics Serving up web pages.
Week 9 PHP Cookies and Session Introduction to JavaScript.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
Tutorial 10 Programming with JavaScript
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Introduction to PHP “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 5 Server Side Scripting Perl.
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
Website Development with PHP and MySQL Saving Data.
Class 2Intro to Databases Goals of this class Include & Require in PHP Generating Random Numbers in PHP Arrays – Numerically Indexed and Associative Program.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
PHP Teresa Worner. What is it? PHP: Hypertext Preprocessor server-side scripting language open source cross-platform compatible with almost all servers.php.php3.phtml.
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.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Introduction to PHP Advanced Database System Lab no.1.
Web Technology Introduction to PHP. PHP PHP stands for PHP Hypertext Preprocessor PHP is a Server-Side Web Scripting language, which executes on the web.
Comments in PHP In PHP, we use // to make a singleline comment or /* and */ to make a large comment block. Comment is a part of your PHP code that will.
Strings, output, quotes and comments
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
Server-Side Scripting with PHP ISYS 475. PHP Manual Website
Introduction to PHP.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
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.
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,
PHP Overview. What is PHP Widely available scripting language Free Alternative to Microsoft’s ASP Runs on the Web Server; not in the browser Example:
CGS 3066: Web Programming and Design Spring 2016 PHP.
PHP – PHP Hypertext Processor A quick overview. How is PHP used? Embedded with HTML, e.g. Not like CGI: PHP files not an executable Used with servers.
First Steps in PHP Creating Very Simple PHP Scripts SoftUni Team Technical Trainers Software University
A pache M ySQL P hp Robert Mudge Reference:
PHP using MySQL Database for Web Development (part II)
CS 371 Web Application Programming
PHP (PHP: Hypertext Preprocessor)
PHP Introduction.
WEB PROGRAMMING JavaScript.
PHP Intro/Overview Bird Book pages 1-11,
PHP.
Web DB Programming: PHP
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
PHP an introduction.
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

PHP MOHAMMED SHURRAB TO MISS/ RASHA ATTALLAH

What is PHP? Stands for "PHP Hypertext Preprocessor" Server-side scripting language HTML-embedded Supports 15 different databases, POP3, IMAP, COM, CORBA Website:

PHP alternatives CGI (+ back-end program) ASP (MS Active server pages) JSP (Sun's Java server pages) Cold Fusion Most of these are not free!

PHP Operation PHP interpreter (on server) reads PHP file As it is processed, it outputs HTML to the server Embedded HTML code (including JavaScript) is passed to the server unchanged Result: "view source" sees only generated HTML, not PHP source

Embedding PHP Code My exciting page! <? //start php //php code goes here ?>

PHP variables All variables begin with $ Variables are not declared Unassigned variables have value NULL –IsSet($var)returns true if var is not NULL Variable names are case sensitive Reserved words (like true, while, etc.) are not

Comments Three styles –# (as in Perl) –// (as in JavaScript) –/* … */ (as in C)

Numbers and conversions Integers and floating point numbers (autotyped when value set) $num = 3;//integer $num = 3.5; //now floating point $num = (int) num ; //back to integer 3 again $num2 = intval(num); //another way to do that $num3 = 3.5; settype($num3, "integer"); //.. And a third way

Output statements Echo –With no parentheses, multiple parameters, otherwise only one –echo "First line ", "Second line "; Print –One parameter, coerced to string, returns result –print("The value is "); print(47); Printf (next slide)

Printf Stands for "print formatted" Takes multiple parameters –A format string, containing directives such as $d (decimal), $f (float), $s (string) Formatting directives can include parameters between $ and letter, e.g. $10d = decimal integer of length 10 –Values to insert for the $ directives Example – printf("Your purchase of $d $s (s) costs $.2f", $quantity, $item, $total_price);

Relational & Boolean Operators Relational operators (for all types) == Same type, same value != Opposite of == >, =, <= Numeric (preferred) or string comparison of values with coercion Boolean operators &&, and (Precedence of and is higher, otherwise same) ||, or (precedence of or is higher, otherwise same) xor (exclusive or) ! (not)

Control Structures If –Like C++ or Java –Can include else if clauses (not elsif) While, for, do-while –Like javascript Foreach –Like Perl

Arrays Combine arrays with Perl hashes Each element has a key and a value –Typical array: key is the integer index –Hash-like array: key is a string Array names begin with $ like other variables

Creating arrays $list1[0] = 17; //creates list unless it exists $list1[] = "hi"; //adds new last element $list2 = array(10,20,30,40); //creates a traditional array of 4 elements $hash = array("a"=>"apple", "b"=>"banana"); //creates a hash with 2 elements $list3 = array(); //creates an empty array

Accessing Array elements $x = $hash['a'] //gets "apple" from the hash $y = $list1[1] //gets "hi" from the traditional array $list ($first, $second, $third, $fourth) = $list2; //assigns list2 to 4 individual variables

Keys and Values Array_keys –Make a traditional array of all the keys Array_values –Make a traditional array of all the values

Sequential access current($array): current element in the array –(initially element 0) next($array): increments the current element and returns the value $city = current($cities); print("$city "); while($city = next($cities)) print("$city ");

Each (array) Like next but returns 2-element array of key and value (keys are "key" and "value") Does not return FALSE for NULL value while($data=each($salaries)){ $name = $data["key"]; $sal = $data["value"]; … }

Foreach Shorthand for each Use for traditional or hash arrays foreach($salaries as $name=>$sal)){ //process names and salaries… } foreach($salaries as $sal){ //process salaries without names.. }

Forms Forms (HTML, not PHP) collect input <form action=URL method={get or post} –Get: parameters in URL –Post: parameters not visible – and statements collect data

Input tags Create a box that you type in: – What you type will be passed as “parameter” lname Many other types of input (checkbox, radio buttons, etc.) -- see documentation

Select Create a menu – – Mickey Mouse –… – If you select an option, it is passed as parameter “ssn”

Forms and PHP If method=post –$_POST is hash with names and values from widgets If method=get –$_GET is hash with names and values from widgets Example: $type = $_POST[‘cuporcone’]