PHP and JavaScript Nov. 26, 2013 Kyung Eun Park Computer and Creativity (COSC109) Towson University.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Multiple Tiers in Action
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Introduction to scripting
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
PHP: Hypertext Processor Fred Durao
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.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
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.
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.
PHP : Hypertext Preprocessor
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
INTERNET APPLICATION DEVELOPMENT For More visit:
Nael Alian Introduction to PHP
Week 9 PHP Cookies and Session Introduction to JavaScript.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
PHP - Basic Language Constructs CSCI 297 Scripting Languages - Day Two.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
What is PHP? IDIA Fall 2014 Bridget M Blodgett.
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.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
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?
JavaScript Syntax, how to use it in a HTML document
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.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
CSC318 – DYNAMIC WEB APPLICATION DEVELOPMENT BY: SITI NURBAYA ISMAIL FACULTY of COMPUTER and MATHEMATICAL SCIENCES.
CSC318 – DYNAMIC WEB APPLICATION DEVELOPMENT BY: SITI NURBAYA ISMAIL FACULTY of COMPUTER and MATHEMATICAL SCIENCES.
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.
1 Server versus Client-Side Programming Server-SideClient-Side.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
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.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
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.
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.
Session 2: PHP Language Basics iNET Academy Open Source Web Development.
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,
11 – Introduction to PHP(1) Informatics Department Parahyangan Catholic University.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Outline  XAMPP  XAMPP Install  Put php and HTML documents  Windows and Mac Version  Security.
PHP using MySQL Database for Web Development (part II)
Chapter 6 JavaScript: Introduction to Scripting
CHAPTER 5 SERVER SIDE SCRIPTING
Exploring JavaScript Ch 14
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
PHP Introduction.
Web Systems Development (CSC-215)
PHP.
Intro to PHP.
Tutorial 6 PHP & MySQL Li Xu
PHP an introduction.
Presentation transcript:

PHP and JavaScript Nov. 26, 2013 Kyung Eun Park Computer and Creativity (COSC109) Towson University

Table of Contents  PHP  JavaScript  XAMPP 2

PHP The language that you use to make the server generate dynamic output. PHP documents end with the extension.php. A Web server passes a PHP program to the PHP processor. A new tag to trigger the PHP commands: <?php echo “Hello World”; ?> 3

The Structure of PHP Looks more like Java, but flexible language Semicolons: PHP commands ends with a semicolon $ symbol: placed in front of all variables <?php $mycounter = 1; $mystring = “Hello”; $myarray = array(“One”, “Two”, “Three”); ?> 4

PHP Variables (1) String variables <?php $username = “Tom Sawyer”; echo $username; ?> Numeric variables <?php $count = 17; echo $count; ?> 5

PHP Variables (2) Array variables <?php $team= array(“Bill”, “Joe”, “Mike”, “Chris”, “Jim”); echo $team[3]; ?> 6

PHP Operators Arithmetic operators: +, -, *, /, %, ++, -- Assignment operators: =, +=, -=, *=, /=,.=, %= Comparison operators: ==, !=, >, =, <= Logical operators: &&, and, ||, or, !, xor 7

PHP Variable operations Assignment $x = 10; $+=10; $y =20; $y -=10; Variable incrementing and decrementing ++$x; --$y; 8

PHP String String concatenation echo “You have ”.$msgs.“ messages.”; $bulletin.= $newsflash; Variable substitution echo “There have been $count presidents of the US.”; Escaping characters $text = “My mother always said \”Eat your greens\”.”; 9

Multiline String Variable Multiple lines between quotes <<< operator <?php $author = “Alfred E Newman”; $out = <<<_END This is a Headline This is the first line. This is the second. - Written by $author. _End; ?> 10

PHP Variable Typing PHP is a very loosely typed language. No need to declare variables before they are used. Context-based variable typing by PHP if necessary. <?php $number = * 67890; echo substr($number, 3, 1); ?> <?php $pi = “ ”; $radius = 5; echo $pi * ($radius * $radius); ?> 11

PHP Constants Similar to variables, but its value is set for the remainder of the program and cannot be altered. define(“ROOT_LOCATION”, “/usr/local/www/”); $directory = ROOT_LOCATION; Predefined constants __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, __METHOD__, __NAMESPACE__ 12

PHP Function To separate out sections of code that perform a particular task. <?php $temp = “The date is “; echo $temp.longdate(time()); function longdate($timestamp) { return date(“ 1 F jS Y”, $timestamp); } ?> 13

JavaScript Client-side scripting language that runs entirely inside the web browser Placed between opening and closing HTML tags My First Web Page document.write(“ My First JavaScript ”); 14

JavaScript Function function myFunction() { alert("Hello World!"); } Try it 15

JavaScript Variables String variables greeting = “hello there” newstring = greeting document.writing(newstring) Numeric Variables count = 42 temperature = Arrays toys = [“bat”, “ball”, “whistle”, “puzzle”, “doll”] document.write(toys[3]); 16

JavaScript Operators Arithmetic operators: +, -, *, /, %, ++, -- Assignment operators: =, +=(string too), -=, *=, /=, %= Comparison operators: ==, !=, >, =, <=, ===, !== Logical operators: &&, ||, ! Incrementing and Decrementing operators: ++, -- String concatenation: + Escaping Characters: \b, \n, \t, \’, \”, \\, etc. 17

JavaScript Typing Like PHP, JavaScript is a very loosely typed language Determined only when a value is assigned and can change as the variable appears in different contexts 18

Installing XAMPP Free and open source cross-platform Web server solution stack pagkage consisting of: The Apache HTTP Server MySQL database Interpreters for scripts written in the PHP and Perl programming language X(cross-platform), Apache HTTP Server, MySQL, PHP, Perl Intended it for use only as a development tool Allow website designers and programmers to test their work on their own computers without any access to the Internet. In practice, however, XAMPP is sometimes used to actually serve web pages on the World Wide Web. Support for creating and manipulating database in MySQL and SQLite Download at:

XAMPP Control Panel 20

Running *.html and *.php files 21

localhost/index.php 22

localhost/index.html 23