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.

Slides:



Advertisements
Similar presentations
Introduction to PHP Dr. Charles Severance
Advertisements

Creating PHP Pages Chapter 7 PHP Decisions Making.
Objectives Using functions to organize PHP code
PHP Conditions MIS 3501, Fall 2014 Jeremy Shafer Department of MIS Fox School of Business Temple University September 11, 2014.
PHP Functions and Control Structures. 2 Defining Functions Functions are groups of statements that you can execute as a single unit Function definitions.
PHP Introduction.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Chapter 4 Functions and Control Structures PHP Programming with MySQL.
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
An Introduction to C Programming Geb Thomas. Learning Objectives Learn how to write and compile a C program Learn what C libraries are Understand the.
Php. What is PHP? PHP is an acronym for "PHP Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on.
Lecture 2 Introduction to PHP MIS 3501, Spring 2014 Jeremy Shafer Department of MIS Fox School of Business Temple University January 30, 2014.
CSC 405: Web Application And Engineering II 2.1 Web Programming with PHP Introduction to Web programming Introduction to Web programming The programming.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
2440: 211 Interactive Web Programming Expressions & Operators.
Language Elements 1. Data Types 2 Floating Point (real) Single Precision Double Precision Decimal Fixed Point (integer) Byte Short Integer Long Numerical.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
Intro to PHP – Page 1 of 43CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: Intro to PHP Reading: Chapters 1.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
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.
1 Session 3: Flow Control & Functions iNET Academy Open Source Web Programming.
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
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.
CONTROL STRUCTURE The if, elseif, and else & switch Statements 1.
PHP Conditional Statements Conditional statements in PHP are used to perform different actions based on different conditions. Conditional Statements Very.
PHP Programming with MySQL Slide 4-1 CHAPTER 4 Functions and Control Structures.
Overview: 1. Discussion of the basic architecture of a web application. 2. Discussion of the relevance of using MySQL and PHP in a web application.
Class 2Intro to Databases Goals of this class Include & Require in PHP Generating Random Numbers in PHP Arrays – Numerically Indexed and Associative Program.
VBScript Language. What is VBScript Based on the Visual Basic family of languages Supports object oriented features Interpreted Loosely Typed Implicitly.
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.
Chapter 2 Functions and Control Structures PHP Programming with MySQL 2 nd Edition.
Control Structures By Shyam Gurram. Control Structure In this chapter we have two different types of structures. Conditional Structure Iterative Control.
PHP Arūnas Liuiza. PHP 101 What is PHP? Widely popular dynamic interpreted opensource programming language, aimed for web development Syntax is simmilar.
PHP Constructs Advance Database Management Systems Lab no.3.
COMPUTER PROGRAMMING II SUMMER 2011 Visual Basic to C#
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
JavaScript Syntax, how to use it in a HTML document
JavaScript, Fourth Edition
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
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.
Chapter 3 Control Structures. The If…Then Statement The If…Then statement is a Decision statement = that executes a set of statements when a condition.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
PHP Programming with MySQL Slide 3-1 CHAPTER 3 Working with Data Types and Operators.
CST336, Dr. Krzysztof Pietroszek Week 2: PHP. 1.Introduction to PHP 2.Embed PHP code into an HTML web page 3.Generate (output HTML) web page using PHP.
FP512 WEB PROGRAMMING 1 PREPARED BY: PN. NUR SYUHADA BINTI MOHAMAD.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Chapter 7: The Repetition Structure Introduction to Programming with C++ Fourth Edition.
USING CONDITIONAL CODE AMIR KHANZADA. Conditional Statement  Conditional statements are the set of commands used to perform different actions based on.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Welcome to Computer Programming II! Computer Programming II Summer 2015.
PHP Condtions and Loops Prepared by Dr. Maher Abuhamdeh.
PHP using MySQL Database for Web Development (part II)
CHAPTER 4 DECISIONS & LOOPS
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Chapter 10 Programming Fundamentals with JavaScript
Web Technologies PHP 5 Basic Language.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Chapter 19 JavaScript.
Chapter 10 Programming Fundamentals with JavaScript
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

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 the code between Echo command is used to put text directly in the web page. PHP code is mixed with the HTML code Comments in PHP are delimited by Either // for a comment on one line /* and */ for blocks of comments.

5-3 Declaration of variables Syntax var $variablename; Variables in PHP start with a dollar sign ("$"). The value that a variable holds can be changed any time at all. Var $myname = “Fred”;

5-4 Constants Syntax define (“Constant_Name”,”value”) Define (“Const tax_rate”, 0.07) The values maybe an integer, floating point or a string.

5-5 Declaring arrays Syntax  $variable = array (val1, val2, …, valn);  $light = array (“red”, “yellow”, “green”); To reference a specific element in the array  $variable[pointervalue]—use parenthesis The first position in an array is position 0.

5-6 Operators Arithmetic operators are the same Relational Operators == -- one equal sign for equal comparison != -- not equal Other relational operators are the same You may expand the relational statements by using the Logical Operators AND, OR The not logical operator is represented by !

5-7 If Construct Basic format if (expresson) { true statements } else { false statements } end if

5-8 If Examples if ($ans == “y”) or ($ans == “Y”) { echo (“We will continue”); } else { echo (“We are stopping”); } if ($total > 1.00) { $total += ($total * 0.07); }

5-9 More on If construct The else clause and false statements are optional The set of true or false statements are enclosed in braces Each if construct must end with the brace delimiter You may nest the if statements using the syntax if (condition) { true statement} elseif (condition) {true statement} else {false statements}

5-10 While Loop Checks the condition and if the condition is true the loop executes. The set of statements is enclosed in a set of brace Format While (expression) { statements }

5-11 While example $try_again = 5; while ($try_again > 0) { echo (“Take another guess” ) ; $try_again = $try_again – 1; }

5-12 For Loop Used when you know how many times you want the loop to execute. This loop structure assumes the loop counter will be incremented by 1 at the end of the loop. The statements for the loop are enclosed between the end of the count and the reserved word next

5-13 For Loop Format for (start counter; stop condition; change counter) {statements }

5-14 FOR Example dim $cntr; for ($cntr = 10; $cntr <= 20; $cntr++) { echo ($cntr); }