FP512 WEB PROGRAMMING 1 PREPARED BY: PN. NUR SYUHADA BINTI MOHAMAD.

Slides:



Advertisements
Similar presentations
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Advertisements

Introduction to C Programming
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.
Javascript Essentials How do I write it??  Start Homesite  Between the start and end BODY tags type: 
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
JavaScript, Third Edition
ALBERT WAVERING BOBBY SENG. Week Whatever: PHP  Announcements/questions/complaints.
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
2010/11 : [1]Building Web Applications using MySQL and PHP (W1)PHP Recap.
INTERNET APPLICATION DEVELOPMENT For More visit:
JavaScript – Part II Data Types and Operations George Mason University June 3, 2010.
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
Nael Alian Introduction to PHP
Chapter 2: Basic Elements of Java J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
2440: 211 Interactive Web Programming Expressions & Operators.
Variables, Operators and Data Types. By Shyam Gurram.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
1 Working with Data Types and Operators. 2 Using Variables and Constants The values stored in computer memory are called variables The values, or data,
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
Arithmetic Operations. Review function statement input/output comment #include data type variable identifier constant declaration.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
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.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
Introduction to PHP Advanced Database System Lab no.1.
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.
Introduction to Web Programming. Introduction to PHP What is PHP? What is a PHP File? What is MySQL? Why PHP? Where to Start?
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.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
VARIABLES, CONSTANTS, OPERATORS ANS EXPRESSION
Chapter 2 Variables.
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 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
JavaScript 1 COE 201- Computer Proficiency. Introduction JavaScript scripting language ▫Originally created by Netscape ▫Facilitates disciplined approach.
Basic Variables & Operators Web Programming1. Review: Perl Basics Syntax ► Comments: start with # (ignored by Perl) ► Statements: ends with ; (performed.
PHP Programming with MySQL Slide 3-1 CHAPTER 3 Working with Data Types and Operators.
PHP Variables.  Variables are "containers" for storing information. How to Declare PHP Variables  In PHP, a variable starts with the $ sign, followed.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
Chapter 3 Introduction to PHP. Incorporating PHP Within HTML By default, PHP documents end with the extension.php files ending with.htm or.html to also.
Addition Multiplication Subtraction Division. 1.If the signs are the same, add the numbers and keep the same sign = = If the.
PHP Syntax You cannot view the PHP source code by selecting "View source" in the browser - you will only see the output from the PHP file, which is plain.
Creating FunctionstMyn1 Creating Functions Function can be divided into two groups: –Internal (built in) functions –User-defined functions.
Session 2: PHP Language Basics iNET Academy Open Source Web Development.
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
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 Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
UNIVERISTY OF SOMALIA College of Engineering and Computer Science Course code: N/A COURSE: WEB DEVELOPMENT WITH PHP
PHP using MySQL Database for Web Development (part II)
CHAPTER 5 SERVER SIDE SCRIPTING
Operators Operators are symbols such as + (addition), - (subtraction), and * (multiplication). Operators do something with values. $foo = 25; $foo – 15;
PHP 5 Syntax.
Design & Technology Grade 7 Python
Variables, Expressions, and IO
JavaScript Syntax and Semantics
PHP Variables A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume) Rules for PHP variables: A variable.
PHP Introduction.
Chapter 19 JavaScript.
Introduction to C++ Programming
With Assignment Operator
PHP.
PHP an introduction.
Algoritma & Pemrograman 1
Presentation transcript:

FP512 WEB PROGRAMMING 1 PREPARED BY: PN. NUR SYUHADA BINTI MOHAMAD

1. Apply the basic structure of PHP syntax and program. 2. Create classes and objects in PHP environment. 3. Use functions in PHP environment. 4. Use arrays and strings in PHP environment. 5. Create PHP web form. 6. Process web form data. 7. Understand cookies and sessions. Learning Outcomes

3.1 Apply the basic structure of PHP syntax and program.

PHP Syntax PHP script always starts with Shorthand-support, The others tags that also can be use:,, Example, index.php:

PHP must end with a semicolon ( ; ) Two basic statements to output text with PHP: – echo a language construct that has no return value and cannot be used in an expression. – print behaves like a function with its own return value (although it is a language construct), can be used in an expression. Statement in PHP

// to make a single-line comment /* and */ to make a large comment block or multi line comment. Comment in PHP

PHP variables are used to hold values or expressions. Rules for PHP variable names: – Variables in PHP starts with a $ sign, followed by the name of the variable – The variable name must begin with a letter or the underscore character – A variable name can only contain alphanumeric characters and underscores (A-z, 0-9, and _ ) PHP Variables

– A variable name should not contain spaces. – Variable names are case sensitive (y and Y are two different variables) Create a variable containing a string, and a variable containing a number:

A variable declared within a PHP function is local and can only be accessed within that function Local Scope Variables

Any variable that is defined outside of any function Accessed from any part of the script that is not inside a function Global Scope Variables Output: 15 $GLOBALS['b'] = $GLOBALS['a'] + $GLOBALS['b'];

Operator An operator is a symbol or series of symbols that, when used in conjunction with values, perform an action and usually produces a new value. An operand is a value used in conjunction with an operator. There are usually two or more operands to one operator.

Arithmetic operators OperatorNameExampleSample Result +Addition Subtraction10 – 37 /Division10 / *Multiplication10 * 330 %Modulus10 % 31

The assignment operator (=) Basic assignment operator in PHP is "=". Example: The value of "$x = 5" is 5.

Incrementing/Decrementing Operators

Comparison between two values Comparison Operators

Logical Operators

Concatenation operator Concatenation operator (.) is used to put two string values together. For example: Output: Hai Amy! Have a nice day !

Constants in PHP A constant is an identifier (name) for a simple value. It’s function returns the value of constant. Syntax: constant(constant ) Output: I love PHP

<?php echo "Twinkle, Twinkle little star. "; $twinkle="Twinkle"; $star="star"; echo "$twinkle, $twinkle little $star. "; $twinkle="Thunder"; $star="elephant"; echo "$twinkle, $twinkle little $star."; ?> Q1: Uses of Variable

Q1: Answer

<?php $num = 8; echo "Value is now $num. "; $num += 2; echo "Add 2. Value is now $num. "; $num -= 4; echo "Subtract 4. Value is now $num. "; $num *= 5; echo "Multiply by 5. Value is now $num. "; $num /= 3; echo "Divide by 3. Value is now $num. "; $num++; echo "Increment value by one. Value is now $num. "; $num--; echo "Decrement value by one. Value is now $num."; ?> Q2: Arithmetic Operators

Q2: Answer Value is now 8. Add 2. Value is now 10. Subtract 4. Value is now 6. Multiply by 5. Value is now 30. Divide by 3. Value is now 10. Increment value by one. Value is now 11. Decrement value by one. Value is now 10.

Q3: Arithmetic & Assignment Operators <?php $x=10; $y=7; $result=$x+$y; echo "$x + $y = $result "; $result=$x-$y; echo "$x - $y = $result "; $result=$x*$y; echo "$x * $y = $result "; $result=$x/$y; echo "$x / $y = $result "; $result=$x%$y; echo "$x % $y = $result "; ?>

= = 3 10 * 7 = / 7 = % 7 = 3 Q3: Answer