8/17/2015CS346 PHP1 Module 1 Introduction to PHP.

Slides:



Advertisements
Similar presentations
IS 6116 Introduction – 10 Jan Lecturer Details Aonghus Sugrue Website: aonghussugrue.wordpress.com
Advertisements

Copyright © 2003 Pearson Education, Inc. Slide 1-1 The Web Wizards Guide to PHP by David A. Lash.
1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 1 Introduction to Perl and CGI.
PHP I.
Java Script Session1 INTRODUCTION.
Adding Dynamic Content to your Web Site
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
The Web Warrior Guide to Web Design Technologies
Server-Side vs. Client-Side Scripting Languages
1 Web Wizards Guide To PHP David Lash Chapter 1 Introduction to PHP.
Introduction to HTML 2006 INT197B. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Introduction to HTML 2004 CIS101. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Introduction to PHP (Part-1) Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
Tutorial 1: Introduction to JavaScript JavaScript - Introductory.
Web Programming Introduction to PHP COM Objectives To understand what PHP is and how a PHP script works with a Web Browser and a Web Server To learn.
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Quick Tour of the Web Technologies: The BIG picture LECTURE A bird’s eye view of the different web technologies that we shall explore and study.
PHP By Dr. Syed Noman Hasany. PHP PHP was originally created by Rasmus Lerdorf in PHP stands for PHP: Hypertext Preprocessor (a recursive acronym).
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 and MySQL Week#1  Course Plan.  Introduction to Dynamic Web Content.  Setting Up Development Server Eng. Mohamed Ahmed Black 1.
The PHP Story. PHP Story PHP is a programming language. Incorporate(join) sophisticated business logic. Widely used general purpose scripting language.
Linux Operations and Administration
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
INTRODUCTION TO WEB DATABASE PROGRAMMING
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Copyright © 2003 Pearson Education, Inc. Slide 1-1 Web Design & Development PHP.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
HTML Structure & syntax
Writing Web Pages By Shyam Gurram. Agenda Writing Web Pages Delimiting PHP Program Units. Displaying Output to Web Pages Putting Comments in PHP Programs.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Write basic.
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.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
1 Welcome to CSC 301 Web Programming Charles Frank.
Web Design (1) Terminology. Coding ‘languages’ (1) HTML - Hypertext Markup Language - describes the content of a web page CSS - Cascading Style Sheets.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
JavaScript Tutorial 1 - Introduction to JavaScript1 Tutorial 1 Introduction to JavaScript Section A – Programming, HTML, and JavaScript.
Introduction to JavaScript CS101 Introduction to Computing.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
©John Samuel 2008 Introduction to PHP. ©John Samuel 2008 Objectives At the end of this class the student will be able to; Create and run a simple php.
WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Chap 2 – Getting Started COMP YL Professor Mattos.
Creating PHP Pages Chapter 5 PHP Structure and Syntax.
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.
©John Samuel 2008 Introduction to PHP Note: These slides are not included in coverage for the BIF703 final exam...
Introduction to the World Wide Web & Internet CIS 101.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
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,
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
PHP stands for …….. “PHP Hypertext Pre-processor” and is a server-side scripting language like ASP. PHP scripts are executed on the server PHP supports.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
Introduction to Programming the WWW I
PHP / MySQL Introduction
Module 1 Introduction to PHP 11/30/2018 CS346 PHP.
Web Page Concept and Design :
Introduction to PHP.
The Web Wizard’s Guide to PHP by David A. Lash
Presentation transcript:

8/17/2015CS346 PHP1 Module 1 Introduction to PHP

8/17/2015CS346 PHP2 Objectives  What is PHP?  How does a PHP script work with a Web Browser and a Web Server?  What software and components you need to get started with PHP?  To create and run a simple PHP script

8/17/2015CS346 PHP3 What Is PHP?  PHP, PHP Hypertext Preprocessor Server-side scripting languages for creating dynamic web pages Server-side scripting languages for creating dynamic web pages

8/17/2015CS346 PHP4 PHP advantages Advantages of Using PHP to enhance Web pages: Easy to use Easy to use Simpler than Perl Simpler than Perl Open source Open source Multiple platform. Multiple platform.

8/17/2015CS346 PHP5 How PHP Pages are Accessed and Interpreted Client: Web browserWeb server 1.Form submitted with a submit button  Action sends a request to the php file in server 3. Receive the request, find the file, and read it 4. Execute the PHP commands 5. Send the results back 6.  ---- results returned as HTML file 7. Web browser renders the HTML file, displaying the results

8/17/2015CS346 PHP6 Getting Started with PHP To develop and publish PHP scripts you need: A Web server with PHP built into it A Web server with PHP built into it A client machine with a basic text editor and Internet connection A client machine with a basic text editor and Internet connection FTP or Telnet software FTP or Telnet software

8/17/2015CS346 PHP7 WHH Note  This means that a browser e.g. IE or Firefox on the client computer will not recognize or render a file with extension.php

8/17/2015CS346 PHP8 Getting Started with PHP  For class demos: Laptop contains a server and a browser environment Laptop contains a server and a browser environment Web server is WAMPserver Web server is WAMPserver Windows Apache, MySQL, PHP Windows Apache, MySQL, PHP Client machine: PC, XP, editors, browsers Client machine: PC, XP, editors, browsers Internet connection not needed Internet connection not needed Use copy and paste to transfer the scripts Use copy and paste to transfer the scripts

8/17/2015CS346 PHP9 Exploring the Basic PHP Development Process The basic steps you can use to develop and publish PHP pages are: 1. Create a PHP script file and save it to a local disk 2. Use FTP to copy the file to the server 3. Access your file via URL using a browser IE, Netscape, Opera, etc.IE, Netscape, Opera, etc.

8/17/2015CS346 PHP10 Check PHP installation  Create a simple PHP script, called checkphp.php The PHP script starts with a The PHP script starts with a Between these tags is a single PHP statement: phpinfo() Between these tags is a single PHP statement: phpinfo()  Copy the file to a directory of server For WAMP: wamp/www For WAMP: wamp/www  Access the file with a browser 

8/17/2015CS346 PHP11

8/17/2015CS346 PHP12 Creating a PHP Script File  Create a simple PHP script, called welcome.php The PHP script starts with a The PHP script starts with a Between these tags is a single PHP print statement Between these tags is a single PHP print statement  Copy the file to C:\wamp\www  Access the file with  demo

8/17/2015CS346 PHP13 Alternative PHP Delimiters  You can alternatively start your PHP scripts with the tag as follows: print ("A simple initial script"); </script>  If short_open_tag enabled in its configuration file (php.ini), you can use.  If asp_tags is enabled in the PHP configuration file, you can use as delimiters.

8/17/2015CS346 PHP14 Copying Files To A Web Server with FTP 1. Connect to the Internet and start FTP. 2. Connect to your Web server with FTP. 3. Copy files to the Web to the Webserver.

8/17/2015CS346 PHP15 Accessing Your File Using a Browser

8/17/2015CS346 PHP16 Proper Syntax  If you have a syntax error then you have written one or more PHP statements that are grammatically incorrect in the PHP language.  The print statement syntax:

8/17/2015CS346 PHP17 If syntax is wrong <?php print ( "Welcome to PHP, CS346 class!); print ( "Welcome to PHP, CS346 class!);?>

8/17/2015CS346 PHP18 A Little About PHP's Syntax  Some PHP Syntax Issues: Be careful to use quotation marks, parentheses, and brackets in pairs. Be careful to use quotation marks, parentheses, and brackets in pairs. Most PHP commands end with a semicolon (;). Most PHP commands end with a semicolon (;). Be careful of case. Be careful of case. PHP ignores blank spaces. PHP ignores blank spaces.

8/17/2015CS346 PHP19 Embedding PHP Statements Within HTML Documents  One way to use PHP is to embed PHP scripts within HTML tags in an HTML document.  Save the file with extension php

8/17/2015CS346 PHP HTML With PHP Embedded 3. HTML With PHP Embedded Welcome To My Page 5. Welcome To My Page 6.<?php 7. print (" Using PHP is not hard "); 8.?> 9.and you can learn to use it quickly!

8/17/2015CS346 PHP21 When embedded1.php is accessed

8/17/2015CS346 PHP22 Using Backslash (\) to Generate HTML Tags with print()  Sometimes you want to output an HTML tag that also requires double quotation marks. Use the backslash (“\”) character to signal that the double quotation marks themselves should be output: print (" "); Use the backslash (“\”) character to signal that the double quotation marks themselves should be output: print (" "); The above statement would output: The above statement would output:

8/17/2015CS346 PHP23 Using Comments with PHP Scripts  Comments enable you to include descriptive text along with the PHP script. Comment lines are ignored when the script runs; they do not slow down the run-time. Comment lines are ignored when the script runs; they do not slow down the run-time. Comments have two common uses. Comments have two common uses. Describe the overall script purpose.Describe the overall script purpose. Describe particularly tricky script lines.Describe particularly tricky script lines.

8/17/2015CS346 PHP24 Using Comments with PHP Scripts  Comment Syntax - Use // standalone <?php // This is a comment ?>  Can be placed on Same line as a statement: <?php print ("A simple initial script"); //Output a line ?>

8/17/2015CS346 PHP25 Example Script with Comments Generating HTML From PHP 2. Generating HTML From PHP 3. Generating HTML From PHP 3. Generating HTML From PHP 4. <?php 5. // 6. // Example script to output HTML tags 7. // 8. print ("Using PHP has some advantages: "); 9. print (" Speed Ease of use 9. print (" Speed Ease of use Functionality "); //Output bullet list Functionality "); //Output bullet list 10. print (" "); 11. ?>

8/17/2015CS346 PHP26 Alternative Comment Syntax PHP allows a couple of additional ways to create comments. <?php phpinfo(); # This is a built-in function ?>  Multiple line comments. <?php <?php/* A script that gets information about the PHP version being used. */

8/17/2015CS346 PHP27 Summary  HTML pages are static and cannot interact with users  PHP is a free, open source technology that enables documents to generate dynamic content  PHP script has the extension of.php  PHP script may be standalone or  Can be embedded in an HTML document

8/17/2015CS346 PHP28 Summary  Resources needed: Web server with built-in PHP Web server with built-in PHP a client machine with a basic text editor, browser, and internet connections a client machine with a basic text editor, browser, and internet connections FTP or Telnet software to send the script to the server FTP or Telnet software to send the script to the server

8/17/2015CS346 PHP29 Summary  PHP script process: write the PHP script file write the PHP script file copy the script file to the Web server copy the script file to the Web server access the file with a Web browser access the file with a Web browser  Comments can be proceeded with two forward slashes (//) two forward slashes (//) or # or # or enclosed in /* and */ or enclosed in /* and */