Company LOGO In the Name of Allah,The Most Gracious, The Most Merciful King Khalid University College of Computer and Information System Web pages Development.

Slides:



Advertisements
Similar presentations
1 Database Driven Web Application Clients Application Servers including web servers Database Server Traditional client-server (2-tier architecture): client:
Advertisements

Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
PHP – An Introduction.
PHP – An Introduction Albert Morita – UCR Libraries Systems Dept. December 9, 2004 Version 2.0.

XP Information Technology Center - KFUPM1 Microsoft Office FrontPage 2003 Creating a Web Site.
Server-Side vs. Client-Side Scripting Languages
Dynamic Web site With PHP and MySQL. MySQL The combination of MySQL database and PHP scripting language is optimum for building dynamic websites. MySQL.
FILE UPLOADS CHAPTER 11. THE BASIC PROCESS 1.The HTML form displays the control to locate and upload a file 2.Upon form submission, the server first stores.
Uploading Files. Why? By giving a user the option to upload a file you are creating an interactive page You can enable users have a greater web experience.
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
PHP By Dr. Syed Noman Hasany. PHP PHP was originally created by Rasmus Lerdorf in PHP stands for PHP: Hypertext Preprocessor (a recursive acronym).
U NIT 4 F ILE U PLOAD. I. C REATE AN U PLOAD -F ILE F ORM - With PHP, it is possible to upload files to the server.To allow users to upload files from.
ITD 3194 Web Application Development Chapter 4: Web Programming Language.
AIT 616 Fall 2002 PHP. AIT 616 Fall 2002 PHP  Special scripting language used to dynamically generate web documents  Open source – Free!!!  Performs.
Languages in WEB Presented by: Jenisha Kshatriya BCM SS09.
PHP was created by Rasmus Lerdorf in It was initially server-side, traffic tracking script. PHP 2 (1995) Added database support, file uploads, regular.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
PHP Professor Waterman. Agenda What is PHP Versions HTML Dynamic Web sites Interactive Web Sites Installing PHP Transfer pages to a Web hosting service.
INTERNET APPLICATION DEVELOPMENT For More visit:
Nael Alian Introduction to PHP
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
PHP With Oracle 11g XE By Shyam Gurram Eastern Illinois University.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
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.
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.
Introducing the World Wide Web Internet- a structure made up of millions of interconnected computers whose users communicate with each other and share.
WEB DEVELOPMENT WITH PHP/MYSQL. WEB DEVELOPMENT COURSE HAS DIFFERENT NAME IN DIFFERENT INSITUTES, THIS IS A CORE COURSE FOR BS/MS STUDENTS. THIS IS ALSO.
Introduction to PHP.
8 th Semester, Batch 2008 Department Of Computer Science SSUET.
Yasar Hussain Malik - NISTE. PHP Origins Rasmus Lerdorf PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP Hypertext Processor’ Other key.
Advanced Web 2012 Lecture 6 Sean Costain Files Sean Costain 2012 Php allows for the : Creation Reading Appending Deleting Uploading And Closing.
PHP “Personal Home Page Hypertext Pre-processor” (a recursive acronym) Allows you to create dynamic web pages and link web pages to a database.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
PHP Introduction PHP is a server-side scripting language.
An Investigation into using a Document Management System Presented by: Bijal RanaSupervisor: John Ebden.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
 Before you continue you should have a basic understanding of the following:  HTML  CSS  JavaScript.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Chapter 13 A & B Programming Languages and the.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
PHP Overview. What is PHP Widely available scripting language Free Alternative to Microsoft’s ASP Runs on the Web Server; not in the browser Example:
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
Unit 7 How to Upload Files. A very useful aspect of PHP is its ability to manage file uploads to your server. Before you can use PHP to manage your uploads,
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.
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.
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
PHP File Handling. Opening a file Fopen(filename,mode) Closing a file Fclose(filename)
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
PHP using MySQL Database for Web Development (part II)
Albert Morita – UCR Libraries Systems Dept.
A PRESENTATION ON (IN PHP,CSS,HTML)
Introduction to Dynamic Web Programming
Introduction to PHP “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be.
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
Introduction to PHP “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be.
Albert Morita – UCR Libraries Systems Dept.
BASIC PHP and MYSQL Edward S. Flores.
PHP Introduction.
Handling Files In particular, uploading files.
PHP.
IntroductionToPHP Static vs. Dynamic websites
Tutorial 6 PHP & MySQL Li Xu
Handling Files In particular, uploading files.
Introduction to PHP.
PHP an introduction.
PHP By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and.
Web Application Development Using PHP
Presentation transcript:

Company LOGO In the Name of Allah,The Most Gracious, The Most Merciful King Khalid University College of Computer and Information System Web pages Development & Programming Alaa Alwabel Chapter 6: PHP 1

Why is PHP used? 2 1.Easy to Use Code is embedded into HTML. The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode ". Example

Why is PHP used? 3 2.Cross Platform Runs on almost any Web server on several operating systems. One of the strongest features is the wide range of supported databases. Web Servers: Apache, Microsoft IIS, Netscape Enterprise Server. Operating Systems: UNIX (HP-UX,OpenBSD,Solaris,Linux), Mac OSX, Windows NT/98/2000/XP/2003. Supported Databases: : MySQL, ODBC, Oracle (OCI7 and OCI8).

Why is PHP used? 4 3.Cost Benefits PHP is free. Open source code means that the entire PHP community will contribute towards bug fixes. There are several add-on technologies (libraries) for PHP that are also free. PHP SoftwareFree PlatformFree (Linux) Development ToolsFree PHP CoderPHP Coder, jEditjEdit

Example 1: ( write Hello World) 5 Simple HTML Page with PHP ( write Hello World )  The following is a basic example to output text using PHP. My First PHP Page Copy the code onto your web server and save it as “test.php”. You should see “Hello World!” displayed. Notice that the semicolon is used at the end of each line of PHP code to signify a line break. Like HTML, PHP ignores whitespace between lines of code.

Example 2 : Day of Week 6 Using conditional statements  Conditional statements are very useful for displaying specific content to the user. The following example shows how to display content according to the day of the week. <?php $today_dayofweek = date(“w”); if ($today_dayofweek == 4){ echo “Today is Thursday!”; } else{ echo “Today is not Thursday.”; } ?>

Example 2 : Day of Week Using conditional statements The if statement checks the value of $today_dayofweek (which is the numerical day of the week, 0=Sunday… 6=Saturday)  If it is equal to 4 (the numeric representation of Thurs.) it will display everything within the first { } bracket after the “if()”.  If it is not equal to 4, it will display everything in the second { } bracket after the “else”. <?php $today_dayofweek = date(“w”); if ($today_dayofweek == 4){ echo “Today is Thursday!”; } else{ echo “Today is not Thursday.”; } ?> 7

Example 2 : Day of Week 8 Using conditional statements  Conditional statements are very useful for displaying specific content to the user. The following example shows how to display content according to the day of the week. <?php $today_dayofweek = date(“w”); if ($today_dayofweek == 4){ echo “Today is Thursday!”; } else{ echo “Today is not Thursday.”; } ?>

Example 2 : Day of Week Using conditional statements If we run the script on a Thursday, we should see: “Today is Thursday”. On days other than Thursday, we will see: “Today is not Thursday.” <?php $today_dayofweek = date(“w”); if ($today_dayofweek == 4){ echo “Today is Thursday!”; } else{ echo “Today is not Thursday.”; } ?> 9

Example 3: Header & Footer Template  PHP is a great way to implement templates on your website.  How to implement a simple page counter 10

Example 3: Header & Footer Template  Step 1: Universal header and footer in a single file  Create a file called header.php. This file will have all of the header HTML code. You can use Dreamweaver to create the header, but remember to remove the closing and tags. King Khalid University Page Title 11

Example 3: Header & Footer Template  Step 2: Universal header and footer in a single file  Next, create a file called footer.php. This file will have all of the footer HTML code. UC Riverside Department 12

Examples  Step 3: Universal header and footer in a single file  This is the basic template that you will use on all of the pages. Make sure you name the files with a.php extension so that the server will process the PHP code. <?php // header include(“header.php”); ?> Insert content here! <?php // footer include(“footer.php”); ?> 13

Examples Benefits: - Any changes to header or footer only require editing of a single file. This reduces the amount of work necessary for site maintenance and redesign. - Helps separate the content and design for easier maintenance Page 1 Content Page 5 Content Page 3 Content Page 2 Content Page 4 Content Header Footer 14

Create an Upload-File Form  To allow users to upload files from a form can be very useful.  Look at the following HTML form for uploading files: 15 Filename:

Create an Upload-File Form  The "upload_file.php" file contains the code for uploading a file: 16 0) { echo "Error: ". $_FILES["fil e"]["error"]. " "; } else { echo "Upload: ". $_FILES["file"]["name"]. " "; echo "Type: ". $_FILES["file"]["type"]. " "; echo "Size: ". ($_FILES["file"]["size"] / 1024). " Kb "; echo "Stored in: ". $_FILES["file"]["tmp_name"]; } ?>

Create an Upload-File Form  The first parameter is the form's input name and the second index can be either "name", "type", "size", "tmp_name" or "error". Like this:  $_FILES["file"]["name"] - the name of the uploaded file  $_FILES["file"]["type"] - the type of the uploaded file  $_FILES["file"]["size"] - the size in bytes of the uploaded file  $_FILES["file"]["tmp_name"] - the name of the temporary copy of the file stored on the server  $_FILES["file"]["error"] - the error code resulting from the file upload 17