A pache M ySQL P hp Robert Mudge Reference:

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
1 Database Driven Web Application Clients Application Servers including web servers Database Server Traditional client-server (2-tier architecture): client:
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).
Introduction to PHP. PHP PHP is the Hypertext Pre-processor –Script language –Embedded into HTML –Runs as Apache module –Can use DB (MySQL, Oracle, Microsoft.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
04/09/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Programming with php By: Seth Larson. A little bit about PHP  PHP stands for PHP:  Hypertext Preprocessor  PHP is a widely-used general-purpose server-side.
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.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
PHP Tutorial By RAY BALIKI && ROY GHORAYEB. DEFINITION PHP is a powerful server-side scripting language for creating dynamic and interactive websites.
PHP Forms and User Input The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.
INTERNET APPLICATION DEVELOPMENT For More visit:
PHP - Hypertext Preprocessor. Introduction PHP is a powerful server-side scripting language for creating dynamic and interactive websites. PHP is a powerful.
SCV1223 PHP - Hypertext Preprocessor. Introduction PHP is a powerful server-side scripting language for creating dynamic and interactive websites. PHP.
Languages in WEB Presented by: Jenisha Kshatriya BCM SS09.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
INTERNET APPLICATION DEVELOPMENT For More visit:
Nael Alian Introduction to PHP
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
PHP2. PHP Form Handling The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. Name: Age:
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Web Programming Language Week 5 Dr. Ken Cosh Introducing PHP 1.
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.
Julian Springer Room 42 Joe Slovo.  W3 schools recommend that you have a basic understanding of HTML and of JavaScript before attempting to grasp PHP.
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?
Introduction to PHP.
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.
PHP Introduction PHP is a server-side scripting language.
Since you’ll need a place for the user to enter a search query. Every form must have these basic components: – The submission type defined with the method.
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.
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,
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
CGS 3066: Web Programming and Design Spring 2016 PHP.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
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.
1 Server Side scripting PHP. 2 What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
Presented By Sushil K. Chaturvedi Assistant Professor SRCEM,Banmore 1.
PHP using MySQL Database for Web Development (part II)
Web Database Programming Using PHP
Session 2 Basics of PHP.
Introduction to Dynamic Web Programming
เอกสารประกอบการบรรยายรายวิชา Web Technology
Web Database Programming Using PHP
PHP (PHP: Hypertext Preprocessor)
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
PHP / MySQL Introduction
8th Semester, Batch 2008 Department of Computer Science SSUET.
PHP Introduction.
PHP.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
IntroductionToPHP Static vs. Dynamic websites
Web Programming Language
Intro to PHP.
Tutorial 6 PHP & MySQL Li Xu
Introduction to PHP.
PHP Forms and Databases.
PHP an introduction.
PHP-II.
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.
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Web Application Development Using PHP
Presentation transcript:

A pache M ySQL P hp Robert Mudge Reference:

What is Apache?  Apache is the de-facto standard in web servers, it is FOSS  Apache powers over 70% of all web sites  Apache is secure, reliable and fast  Apache is easy to install and configure  Apache will run on Windows, Linux and UNIX

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 many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)  PHP is an open source software (OSS)  PHP is free to download and use

What is MySQL?  MySQL is a small database server  MySQL is ideal for small and medium applications  MySQL supports standard SQL  MySQL compiles on a number of platforms  MySQL is free to download and use

PHP + MySQL + Apache  PHP combined with MySQL are cross- platform (means that you can develop in Windows and serve on a Unix platform)

Learning Pyramid HTML/xHTML Scripting Internet / Web Server / Database Server Cascading Style Sheets Programming C++/Java Object Oriented Design SQL Program Design PHP

System Configuration  Apache Server Installation Apache/conf/httpd.conf Add module php  MySQL Server Installation my.ini passwords  PHP Installation php.ini add module for MySQL

Debugging in Php  Php.ini settings  Print statements  Debuggers Dbg ( Gubed (  Summary

PHP Introduction  PHP File  HTML Header  PHP script delimiter  PHP Comments  PHP Variables  PHP Language  PHP Functions/Manual

What is a PHP File?  PHP files may contain text, HTML tags and scripts  PHP files are returned to the browser as plain HTML  PHP files have a file extension of ".php", ".php3", or ".phtml"

HTML File Format Untitled Document

xHTML File Format Page Title Add Doc Type Well Formed All Tags open and close or

PHP Script Delimiters <?php echo "Hello World"; ?>

PHP Comments

PHP Variables Variable Naming Rules A variable name must start with a letter or an underscore "_" A variable name can only contain alpha-numeric characters and underscores (a-Z, 0-9, and _ ) A variable name should not contain spaces. If a variable name should be more than one word, it should be separated with underscore ($my_string), or with capitalization ($myString)

PHP Variables + Concatenation

Arithmetic Operators

Assignment & Comparison

Logical Operators

If – elseif - else

switch-case-default

PHP Arrays  When working with PHP, sooner or later, you might want to create many similar variables. Instead of having many similar variables, you can store the data as elements in an array.  Each element in the array has its own ID so that it can be easily accessed.  There are three different kind of arrays: Numeric array - An array with a numeric ID key Associative array - An array where each ID key is associated with a value Multidimensional array - An array containing one or more arrays

Numeric Arrays  A numeric array stores each element with a numeric ID key.  There are different ways to create a numeric array.

Numeric Array - Examples Output: Quagmire and Joe are Peter's neighbors

Associative Arrays  An associative array, each ID key is associated with a value.  When storing data about specific named values, a numerical array is not always the best way to do it.  With associative arrays we can use the values as keys and assign values to them.

Associative Array - Example  Example 1 In this example we use an array to assign ages to the different persons:

Associative Array - Examples Output: Peter is 32 years old.

Multi-dimensional Arrays  In a multidimensional array, each element in the main array can also be an array.  Each element in the sub-array can be an array, and so on.

Multi-dim Array Example

Repetition and Looping  Very often when you write code, you want the same block of code to run a number of times. You can use looping statements in your code to perform this.  In PHP we have the following looping statements: while - loops through a block of code if and as long as a specified condition is true do...while - loops through a block of code once, and then repeats the loop as long as a special condition is true for - loops through a block of code a specified number of times foreach - loops through a block of code for each element in an array

while loop Zero to n loops

do – while Loop At least once + n loops

for loop - repetition  The for statement is used when you know how many times you want to execute a statement or a list of statements.  Note: The for statement has three parameters. The first parameter initializes variables, the second parameter holds the condition, and the third parameter contains the increments required to implement the loop. If more than one variable is included in the initialization or the increment parameter, they should be separated by commas. The condition must evaluate to true or false.

for loop - example

foreach loop  The foreach statement is used to loop through arrays.  For every loop, the value of the current array element is assigned to $value (and the array pointer is moved by one) - so on the next loop, you'll be looking at the next element.

foreach - Example

Php Functions  A function is a block of code that can be executed whenever we need it.  Creating PHP functions: All functions start with the word "function()" Name the function - It should be possible to understand what the function does by its name. The name can start with a letter or underscore (not a number) Add a "{" - The function code starts after the opening curly brace Insert the function code Add a "}" - The function is finished by a closing curly brace

Function Example <?php function writeMyName() { echo “John Smith"; } writeMyName(); ?>

Function Parameters <?php function writeName($first, $second) { echo $first. “ $second”. ‘ ’; } writeName(‘John’, ‘Smith’); ?>

Function Returns <?php function getName($first, $second) { $name = $first. “ $second”. ‘ ’; return $name; } getName(‘John’, ‘Smith’); ?>

Forms and User Input  The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.  The most important thing to notice when dealing with HTML forms and PHP is that any form element in an HTML page will automatically be available to your PHP scripts.  print_r($_POST);  echo $_SERVER['PHP_SELF'];

Forms Example welcome.php input.php

Form Validation  User input should be validated on the browser whenever possible (by client scripts (JavaScript)). Browser validation is faster and you reduce the server load.  You should consider using server validation if the user input will be inserted into a database.  A good way to validate a form on the server is to post the form to itself, instead of jumping to a different page. The user will then get the error messages on the same page as the form. This makes it easier to discover the error.

Php $_GET  The $_GET variable is used to collect values from a form with method="get".  The $_GET variable is an array of variable names and values sent by the HTTP GET method.  The $_GET variable is used to collect values from a form with method="get". Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and it has limits on the amount of information to send (max. 100 characters).

Php $_GET Example input.php welcome.php

Php $_GET Considerations  When using the $_GET variable all variable names and values are displayed in the URL.  This method should not be used when sending passwords or other sensitive information.  The variables are displayed in the URL, it is possible to bookmark the page. This can be useful in some cases.  The HTTP GET method is not suitable on large variable values; the value cannot exceed 100 characters.

Php $_REQUEST  The PHP $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE.  The PHP $_REQUEST variable can be used to get the result from form data sent with both the GET and POST methods.

Php $_POST  $_POST variable is used to collect values from a form with method="post".  The $_POST variable is an array of variable names and values sent by the HTTP POST method.  The $_POST variable is used to collect values from a form with method="post". Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

Php $_POST Example welcome.php input.php

Homework #2  Create a Login Web Page  User enters “username” and “password”  Upon successful input and comparison to a hard coded password, present a welcome page showing the username and password  Turn in your source code and screen captures from the operation through a web server.