Intro to PHP IST2101. Review: HTML & Tags 2IST210.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: The Basics.
Introduction to JavaScript
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
BY: ALBERTO CABEZAS 4/19/2010. INTRODUCTION: PHP is considered today as one of the most famous scripting languages. PHP is widely used as a general purpose.
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.
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.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
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.
Web Page A page displayed by the browser. Website Collection of multiple web pages Web Browser: A software that displays web pages on client computer.
PHP: Introduction By Trevor Adams.
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”
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
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.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
ITM352 PHP and Dynamic Web Pages: Server Side Processing.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
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
Server- Side technologies Client-side vs. Server-side scripts PHP basic ASP.NET basic ColdFusion.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
University of Sunderland Lecture 1 Internet Software Architectures Lecture 1: Introduction.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
PHP TUTORIAL. HISTORY OF PHP  PHP as it's known today is actually the successor to a product named PHP/FI.  Created in 1994 by Rasmus Lerdorf, the very.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Java CGI Lecture notes by Theodoros Anagnostopoulos.
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
Tutorial 10 Programming with JavaScript
JavaScript – Quiz #9 Lecture Code:
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
HTML Basic IST2101. Keep In Mind Programming can be time consuming. Plan ahead!
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
PHP Logic. Review: Variables Variables: a symbol or name that stands for a value – Data types ( Similar to C++ or Java): Int, Float, Boolean, String,
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
Introduction to PHP Advanced Database System Lab no.1.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
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.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
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.
HTML BASIC IST 210: Organization of Data IST210 1.
STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH ( ) SOMYA SHRIVASTAV ( ) SONAM JINDAL ( )
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
Chap 2 – Getting Started COMP YL Professor Mattos.
Servers- Apache Tomcat Server Server-side scripts- Java Server Pages.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
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.
PHP Form Processing * referenced from
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,
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
HTML Basic IST 210: Organization of Data IST2101.
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
Tutorial 10 Programming with JavaScript
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
Intro to PHP & Variables
Intro to PHP.
An Introduction to JavaScript
Presentation transcript:

Intro to PHP IST2101

Review: HTML & Tags 2IST210

How A Web Server Works Find the IP address of the server my.up.ist.psu.edu Send the request to the server HelloWorld.html Hello World! Get file: helloworld.html From folder zuz22 Return to user 3IST210 User Web Server

Problems with HTML Static pages – Cannot provide dynamic contents based on user preferences and interest Users often need different things in different conditions – Google – Facebook – ANGEL, webmail 4IST210

Dynamic Web Contents Through PHP scripts – Programs that can generate dynamic HTML results Two types of scripts – Client side: running inside a browser HTML – Server side: running inside a web server PHP 5IST210

Dynamic Page Example: Show Date Today is: 01/16/14 6IST210

Try it yourself Start Notepad or Notepad++ Create a PHP document to show the date Save as a php document, e.g. date.php Place your php document on IST web space Access it through URL: – 7IST210

How It Works: More Details When a browser requests an HTML file, the HTTP server returns the file When a browser requests an PHP file – The web server passes the request to a PHP interpreter – The PHP interpreter reads the PHP file, line by line, and executes the scripts in the file – Finally, the executed result is returned to the web server, which delivers HTML contents to the browser 8IST210

PHP Must Work Through a Web Server Check the date.php file in the folder Right click the file in the folder, Open it with a web browser, and see what happens. Try “View Page Source” DON’T CLICK ON PHP PAGE DIRECTLY!!! PUT PHP PAGE ON WEBSPACE AND VISIT THROUGH WEB BROWSER!!! 9IST210

PHP and HTML HTMLPHP Used to how to display text and other objects in a browser window Used to dynamically create web pages written in HTML Runs on the client sideRuns on the server side IST21010

About PHP (Hypertext Preprocessor) Created in 1994 by Rasmus Lerdorf A simple set of Common Gateway Interface binaries written in the C programming language Originally used to track visits to his online resume “Personal Home Page tools” PHP is used as the server-side programming language on 75% of all Web sites – E.G. Facebook, Wikipedia IST21011

PHP – Getting started PHP code segments are mixed with HTML source Escaping from HTML (To tell PHP processor: this is PHP code) A PHP parser starts to execute codes when it encounters a start tag The parser does not process non-PHP code Two options indicating the embedded PHP codes 12IST210 ( ) …

echo IST21013 echo means “print it to html” Double quotes pair “” define a string Semicolon ; means the end of a sentence <?php echo "Hello World!"; ?>

echo IST21014 <?php echo "Hello World!"; ?> HTML is not a strict language. It is OK to only have PHP part.

echo: HTML tags IST21015 <?php echo " Hello World! "; ?>

Exercise 1: echo IST21016 Step 1: Open NotePad++ and create “helloworld.php” in your webspace Step 2: Using the codes above as reference, write codes to get the output on the right: “Penn State” in bold A break after “Penn State” “red” in color red <?php echo " Hello World! "; ?>

echo: Multiple PHP segments IST21017 This is HTML part. Hello world in HTML. <?php echo "Hello World in PHP! "; ?> Back to HTML again! <?php echo "Hello World in PHP again!"; ?>

echo echo — Output one or more strings – String is defined in a pair of " " – String concatenate using. IST21018 <?php echo "Welcome "." "."Hello World"; ?>

echo IST21019 echo "Welcome "." "."Hello World"; echo "Welcome Hello World"; echo "Welcome"; echo " "; echo "Hello World";

Variables Data types – Similar to C++ or Java Int, Float, Boolean, String Array (next class), Object (not covered in our class) Variables: a symbol or name that stands for a value – PHP variables start with $ – You can use variables without defining the type $x = 5; $pi = 3.14; $name = "George"; – Name your variables in meaningful ways $s = "matrix" vs. $servername = “matrix” – Case sensitive! More data types – IST21020

Variables IST21021 <?php $x = 1; //integer $y = 2.2; //float $z = "hello"; //string echo "x is $x "; echo "x is ".$x." "; echo "y is $y "; echo "z is $z"; ?> 1.Open your helloworld.php 2.Input following codes 3.Visit through web browser Try it $x can be put insides quotes or outside quotes. When $x is outside of quotes, remember to use. to concatenate two strings

Variables: Debug IST21022 <?php $name = "John"; echo "My name is $Name."; ?> Name is not shown. Where is the bug?

Variables: Output Quotes IST21023 <?php $x = 1; //integer $y = 2.2; //float $z = "hello"; //string echo "z is \"$z\""; ?> In PHP, you can use \ to escape quotes. quotes on hello

Variables: HTML Tags IST21024 <?php $x = "Penn State"; echo "I love $x "; ?> Penn State in bold