Introduction to PHP Brendan Knight. What is PHP PHP is a general-purpose scripting language originally designed for web development to produce dynamic.

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

PHP I.
PHP Hypertext Preprocessor Information Systems 337 Prof. Harry Plantinga.
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.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
XAMPP: Cross – Apache, MySQL, Php, Perl + FileZilla, Tomcat NetBeans: IDE PHP Installation.
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
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.
PHP & MySQL Mahak Arora Vivek Bangera. Outline How PHP works Basic scripting in PHP Forms in PHP(GET & POST Variables) SQL basics PHP and MySQL connection.
PHP By Dr. Syed Noman Hasany. PHP PHP was originally created by Rasmus Lerdorf in PHP stands for PHP: Hypertext Preprocessor (a recursive acronym).
PHP: Introduction By Trevor Adams.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
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.
PHP: Hypertext Processor Fred Durao
04/09/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
IDK0040 Võrgurakendused I harjutus 07: PHP: Operators, Switch, Forms Deniss Kumlander.
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.
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
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.
Server- Side technologies Client-side vs. Server-side scripts PHP basic ASP.NET basic ColdFusion.
What is MySQL? MySQL is a database. The data in MySQL is stored in database objects called tables. A table is a collections of related data entries and.
PHP Tutorial By RAY BALIKI && ROY GHORAYEB. DEFINITION PHP is a powerful server-side scripting language for creating dynamic and interactive websites.
INTERNET APPLICATION DEVELOPMENT For More visit:
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
Mandakini Ayushi Infotech Mandakini Kumari 22 nd July PHP Basic.
Internet and Web Application Development Revision.
INTERNET APPLICATION DEVELOPMENT For More visit:
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
INTERNET APPLICATION DEVELOPMENT For More visit:
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Nael Alian Introduction to PHP
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
Polling System Part 1 Creating PHP & MySQL Files CIS 254.
NMD202 Web Scripting Week3. What we will cover today Includes Exercises PHP Forms Exercises Server side validation Exercises.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
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.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Introduction to PHP Advanced Database System Lab no.1.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
Introduction to Web Programming. Introduction to PHP What is PHP? What is a PHP File? What is MySQL? Why PHP? Where to Start?
PHP Open source language for server-side scripting Works well with many databases (e.g., MySQL) Files end in.php,.php3 or.phtml Runs on all major platforms.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
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.
Creating Databases for Web applications Server side vs client side PHP basics Homework: Get your own versions of sending working: both html and Flash!
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
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.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
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,
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.
Web Database Programming Using PHP
Introduction to Dynamic Web Programming
เอกสารประกอบการบรรยายรายวิชา Web Technology
Web Database Programming Using PHP
PHP / MySQL Introduction
PHP Introduction.
Tutorial 6 PHP & MySQL Li Xu
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.
Presentation transcript:

Introduction to PHP Brendan Knight

What is PHP PHP is a general-purpose scripting language originally designed for web development to produce dynamic web pages. PHP code is embedded into the HTML source document or as a stand alone PHP is interpreted by a web server with a PHP processor module, which generates the web page document. PHP can collect data from forms, any form element will automatically available to PHP

PHP PHP is specified by And.php  PHP supports many different kinds of databases including mysql and oracle  PHP is used as the server-side programming language on over 25 million unique domains including Wikkipedia and Facebook.

Putting it in HTML <html><head> Example Example <body> <?php <?php echo "Hi, I'm a PHP script!"; ?> </body></html>

Form html Name: Age:

Sends to PHP Welcome.PHP Welcome ! Welcome ! You are years old. You are years old.

$_GET $_POST $_REQUEST Sends information Sends information All have particular features All have particular features Request covers both get and post Request covers both get and post

Variables All variables in PHP start with a $ sign symbol. All variables in PHP start with a $ sign symbol. Type is set automatically Type is set automatically Can be assigned Can be assigned Can be concatenated using the. operator Can be concatenated using the. operator

Examples <?php <?php $txt1="Hello World!”; $txt1="Hello World!”; $txt2="What a nice day!"; $txt2="What a nice day!"; echo $txt1. " ". $txt2; echo $txt1. " ". $txt2; ?> ?>

IF / assignment <html><body><?php$d=date("D"); if ($d=="Fri") echo "Have a nice weekend!"; else echo "Have a nice day!"; ?></body></html>

Other Conditionals Conditionals Arrays Arrays

Functions There are more than 700 built in functions There are more than 700 built in functions You can your own functions. You can your own functions. To keep the script from being executed when the page loads, you can put it into a function. To keep the script from being executed when the page loads, you can put it into a function. A function will be executed by a call to the function. A function will be executed by a call to the function. You may call a function from anywhere within a page. You may call a function from anywhere within a page. To let a function return a value, use the return statement. To let a function return a value, use the return statement.

Function example <?php <?php function writeName() function writeName() { echo ”Fred Nurk"; echo ”Fred Nurk"; } ?> ?> Somewhere “far far away” we call it <?php <?php echo "My name is ";writeName(); echo "My name is ";writeName(); ?> ?>

Handy to know Sessions Sessions Error handling Error handling Uploading files / file handling Uploading files / file handling Filtering for input type Filtering for input type Cookies Cookies Validating input Validating input

Data from Form.html to Insert.php Firstname: Firstname: Lastname: Lastname: Age: Age:

Insert.php connects Connect using <?php <?php $con = mysql_connect(servername,username,pas sword); $con = mysql_connect(servername,username,pas sword); if (!$con) { die('Could not connect: '. mysql_error()); } …………. if (!$con) { die('Could not connect: '. mysql_error()); } ………….

From Insert.php to db mysql_select_db("my_db", $con);$sql="INSERT INTO Persons (FirstName, LastName, Age) mysql_select_db("my_db", $con);$sql="INSERT INTO Persons (FirstName, LastName, Age) VALUES VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[age]')"; ('$_POST[firstname]','$_POST[lastname]','$_POST[age]')"; if (!mysql_query($sql,$con)) if (!mysql_query($sql,$con)) { die('Error: '. mysql_error()); die('Error: '. mysql_error()); } echo "1 record added"; echo "1 record added"; mysql_close($con mysql_close($con ?> ?>

Data from db The SELECT statement is used to select data from a database...SELECT column_name(s)FROM table_name The SELECT statement is used to select data from a database...SELECT column_name(s)FROM table_name