The Web Wizard’s Guide to PHP by David A. Lash

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 1-1 The Web Wizards Guide to PHP by David A. Lash.
Advertisements

1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 1 Introduction to Perl and CGI.
Introduction to JavaScript
A guide to HTML. Slide 1 HTML: Hypertext Markup Language Pull down View, then Source, to see the HTML code. Slide 1.
XHTML Basics.
Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
1 Web Wizards Guide To PHP David Lash Chapter 1 Introduction to PHP.
CIS101 Introduction to Computing
Introduction to HTML 2006 CIS101. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
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.
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.
Chapter 2 Introduction to HTML5 Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
CIS101 Introduction to Computing Week 06. Agenda Your questions Excel Exam during second hour Our status after the snow day Introduction to the Internet.
Chapter 4 Mixing PHP and HTML  In this chapter, you’ll learn how to do the following: -Recognize and use the different kinds of PHP start and end tags.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
Exploring Microsoft Office XP - Microsoft Word 2002 Chapter 61 Exploring Microsoft Word Chapter 6 Creating a Home Page and Web Site By Robert T. Grauer.
Copyright © 2003 Pearson Education, Inc. Slide 1-1 Web Design & Development PHP.
HTML Structure & syntax
Essential Tags Web Design – Sec 3-3 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
All Web pages are written with some form of HTML (HyperText Markup Language). HTML documents are saved as Text Only files so virtually any computer can.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
Introduction to HTML. What is a HTML File?  HTML stands for Hyper Text Markup Language  An HTML file is a text file containing small markup tags  The.
HTML INTRODUCTION. What is HTML?  HTML stands for Hypertext Markup Language  Developed in 1990  Hidden code that helps us communicate with others on.
Basic HTML PowerPoint How Hyper Text Markup Language Works
Introduction to HTML Wah Yan College (Hong Kong) Mr. Li C.P.
HTML Structure & syntax. Introduction This presentation introduces the following: Doctype declaration HTML Tags, Elements and Attributes Sections of a.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
Web Page Design Introduction. The ________________ is a large collection of pages stored on computers, or ______________ around the world. Hypertext ________.
Introduction to JavaScript CS101 Introduction to Computing.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Creating PHP Pages Chapter 5 PHP Structure and Syntax.
LBSC 690 Session 4 Programming. Languages How do we learn a language? Learn by listening Then reading Then writing How do we teach programming? Learn.
Introduction to HTML Simple facts yet crucial to beginning of study in fundamentals of web page design!
1 2/16/05CS120 The Information Era Chapter 4 Basic Web Page Construction TOPICS: Intro to HTML and Basic Web Page Design.
HTML HyperText Markup Language Victoria E. Kozlek.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Word 2003 Working Together 1 Word 2003 and Your.
Basic Web Page Design. Text book: HTML, XHTML, and CSS: Visual QuickStart Guide, Sixth Edition written by Elizabeth Castro. Software: Adobe® Dreamweaver®
HTML Structure & syntax
HTML Structure & syntax
Basic HTML Introduction to HTML.
Getting Started with HTML
Pertemuan 1 Desain web Pertemuan 1
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
Introduction to HTML.
Chapter 6 JavaScript: Introduction to Scripting
Exploring Microsoft Word 2000
CHAPTER 5 SERVER SIDE SCRIPTING
Chapter 2, Part I Introduction to C Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Basic HTML PowerPoint How Hyper Text Markup Language Works
3.00cs HTML Overview 3.00cs Develop webpages.
Introduction to Programming the WWW I
Introduction to Scripting
Basic HTML PowerPoint How Hyper Text Markup Language Works
Introduction to JavaScript
Introduction to JavaScript
Module 1 Introduction to PHP 11/30/2018 CS346 PHP.
Java Applets.
Introduction to HTML Simple facts yet crucial to beginning of study in fundamentals of web page design!
Internet Technologies I - Lect.01 - Waleed Ibrahim Osman
Understand basic HTML and CSS terminology, concepts, and basic operations. Objective 3.01.
Pertemuan 1 Desain web Pertemuan 1
HyperText Markup Language
An Introduction to JavaScript
HTML Structure & syntax
Introduction to JavaScript
Presentation transcript:

The Web Wizard’s Guide to PHP by David A. Lash Copyright © 2003 Pearson Education, Inc.

CHAPTER 1 Introduction to PHP Copyright © 2003 Pearson Education, Inc.

Objectives To understand what PHP is and how a PHP script works with a Web Browser and a Web Server To learn what software and components you need to get started with PHP To create and run a simple PHP script Copyright © 2003 Pearson Education, Inc.

HTML? The Hypertext Markup Language (HTML) uses coded commands called HTML tags that provide instructions to Web browsers indicating how to display each page Copyright © 2003 Pearson Education, Inc.

Web Technology Background Copyright © 2003 Pearson Education, Inc.

What Is PHP? Advantages of Using PHP to enhance Web pages: Easy to use. Open source. Multiple platform. Copyright © 2003 Pearson Education, Inc.

How PHP Pages are Accessed and Interpreted Copyright © 2003 Pearson Education, Inc.

Getting Started with PHP To develop and publish PHP scripts all you need is: A Web server with PHP built into it A client machine with a basic text editor and Internet connection FTP or Telnet software Copyright © 2003 Pearson Education, Inc.

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 SSH-FTP to copy the file to the server. 3. Access your file using a browser. Copyright © 2003 Pearson Education, Inc.

Creating a PHP Script File and Saving It to a Local Disk You can use a number of different editors to create your PHP script files. The PHP script starts with a <?php tag and ends with ?>. Between these tags is a singlePHP print statement. Copyright © 2003 Pearson Education, Inc.

Alternative PHP Delimiters You can alternatively start your PHP scripts with the <script> tag as follows: <script language="PHP"> print ("A simple initial script"); </script> If have short_open_tag enabled in its configuration file, you can use <? and ?>. If asp_tags is enabled in the PHP configuration file, you can use <% and %> as delimiters. Copyright © 2003 Pearson Education, Inc.

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 server. Copyright © 2003 Pearson Education, Inc.

Accessing Your File Using a Browser Copyright © 2003 Pearson Education, Inc.

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: Copyright © 2003 Pearson Education, Inc.

If Use Improper Syntax Suppose you use the wrong syntax: 1. <?php 2. print ( “A simple initial script); 3. ?> Copyright © 2003 Pearson Education, Inc.

A Little About PHP's Syntax Some PHP Syntax Issues: Be careful to use quotation marks, parentheses, and brackets in pairs. Most PHP commands end with a semicolon (;). Be careful of case. PHP ignores blank spaces. Copyright © 2003 Pearson Education, Inc.

Embedding PHP Statements Within HTML Documents One way to use PHP is to embed PHP scripts within HTML tags in an HTML document. 1. <html> 2. <head> 3. <title>HTML With PHP Embedded</title> </head> 4. <body> 5. <font size=5 color=”blue”>Welcome To My Page</font> 6. <?php 7. print ("<br> Using PHP is not hard<br>"); 8. ?> 9. and you can learn to use it quickly! 10. </body></html> Copyright © 2003 Pearson Education, Inc.

Would Output The Following ... Copyright © 2003 Pearson Education, Inc.

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 ("<font color=\"blue\">"); The above statement would output: <font color="blue"> Copyright © 2003 Pearson Education, Inc.

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. Comments have two common uses. Describe the overall script purpose. Describe particularly tricky script lines. Copyright © 2003 Pearson Education, Inc.

Using Comments with PHP Scripts Comment Syntax - Use // <?php // This is a comment ?> Can place on Same line as a statement: print ("A simple initial script"); //Output a line Copyright © 2003 Pearson Education, Inc.

Example Script with Comments 1. <html> <head> 2. <title> Generating HTML From PHP</title> </head> 3. <body> <h1> Generating HTML From PHP</h1> 4. <?php 5. // 6. // Example script to output HTML tags 7. // 8. print ("Using PHP has <i>some advantages:</i>"); 9. print ("<ul><li>Speed</li><li>Ease of use</li> <li>Functionality</li></ul>"); //Output bullet list 10. print ("</body></html>"); 11. ?> Copyright © 2003 Pearson Education, Inc.

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 /* A script that gets information about the PHP version being used. */ <? phpinfo(); ?> Copyright © 2003 Pearson Education, Inc.

Summary You can embed a PHP script within an HTML document or run it as a stand-alone script. To begin working with PHP you need a Web server with built-in PHP, a client machine with a basic text editor, and FTP or Telnet software. PHP script process: write the PHP script, copy its file to the Web server, and access the file with a Web browser. Comments can be proceeded two forward slashes (//). Copyright © 2003 Pearson Education, Inc.