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.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

TRAINING PHP ALUMNI DAN CALON ALUMNI STMIK SURABAYA Teguh Sutanto Sistem Informasi | STMIK Surabaya Juni 2014.
Server & Client  Client: Your computer  Server: Powerful & Expensive computer. Requires network access.
PHPPHP What is PHP? Hypertext Pre-processor (PHPs) is a server- side scripting language In early versions, PHP stand for Personal Home Page. server-side.
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).
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
Intro to PHP Introduction to server-side scripts (It’s all good :D) © TAFE NSW
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
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 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:
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Mandakini Ayushi Infotech Mandakini Kumari 22 nd July PHP Basic.
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
Server & Client  Client: Your computer  Server: Powerful & Expensive computer. Requires network access.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
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 PHP.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
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.
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,
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
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 Introduction to Server-Side Programming.
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.
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.
A pache M ySQL P hp Robert Mudge Reference:
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
PHP using MySQL Database for Web Development (part II)
CGS 3066: Web Programming and Design Spring 2017
Remote hosts and web servers
CGS 3066: Web Programming and Design Spring 2017
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Chapter 5 Scripting Language
เอกสารประกอบการบรรยายรายวิชา Web Technology
Introduction to Web programming
Introduction to 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.
Chapter 5 Scripting Language
PHP / MySQL Introduction
PHP Introduction.
PHP FORM HANDLING Post Method
PHP Overview PHP: Hypertext Preprocessor Server-Side Scripting
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.
Introduction to Web programming
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Web Application Development Using PHP
Presentation transcript:

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 not for commercial use.

PHP

Introduction to PHP PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use What is a PHP File? PHP files can contain text, HTML, CSS, JavaScript, and PHP code PHP code are executed on the server, and the result is returned to the browser as plain HTML PHP files have extension ".php"

Introduction to PHP What Can PHP Do? PHP can generate dynamic page content PHP can create, open, read, write, delete, and close files on the server PHP can collect form data PHP can send and receive cookies PHP can add, delete, modify data in your database PHP can be used to control user-access PHP can encrypt data With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML.

Features of PHP PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.) PHP is compatible with almost all servers used today (Apache, IIS, etc.) PHP supports a wide range of databases PHP is free. Download it from the official PHP resource: www.php.net PHP is easy to learn and runs efficiently on the server side

PHP Syntax Basic PHP Syntax A PHP script can be placed anywhere in the document. A PHP script starts with <?php and ends with ?>: <?php // PHP code goes here ?> The default file extension for PHP files is ".php".

sample code – Example 1 to print Hello World using PHP <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php echo "Hello World!"; ?> </body> </html>

sample code – Example 2 variable declaration <html> <body> <?php $txt = "Hello world!"; $x = 5; $y = 10.5; echo $txt; echo "<br>"; echo $x; echo "<br>"; echo $y; ?> </body> </html> Out Put "Hello world!" 5 10.5

sample code – Example 3- To output text and a variable <html> <body> <?php $txt = "W3Schools.com"; echo "I love " . $txt . ; ?> </body> </html> <html> <body> <?php $txt = "W3Schools.com"; echo "I love $txt"; ?> </body> </html>

Program for addition of two numbers <body> <?php $n1=5; $n2=6; $sum=$n1+$n2; Echo “Summation is”.$sum; ?> </body>

PHP Comparison Operators Name Example Result == Equal $x == $y Returns true if $x is equal to $y === Identical $x === $y Returns true if $x is equal to $y, and they are of the same type != <> Not equal $x != $y Returns true if $x is not equal to $y > Greater than $x > $y Returns true if $x is greater than $y < Less than $x < $y Returns true if $x is less than $y >= Greater than or equal to $x >= $y Returns true if $x is greater than or equal to $y <= Less than or equal to $x <= $y Returns true if $x is less than or equal to $y

Form Handling- using Post Method Welcome.php a.html <html> <body> <form action="welcome.php" method="post"> Name: <input type="text" name="name"> <br> <input type="submit"> </form> </body> </html> <html> <body> Welcome <?php echo $_POST["name"]; ?> </body> </html>

Form Handling- using Get Method Welcome.php a.html <html> <body> <form action="welcome.php" method=“get"> Name: <input type="text" name="name"> <br> <input type="submit"> </form> </body> </html> <html> <body> Welcome <?php echo $_GET["name"]; ?> </body> </html>

Form Handling- Difference between get and post method $_GET is an array of variables passed to the current script via the URL parameters. $_POST is an array of variables passed to the current script via the HTTP POST method. When to use GET? Information sent from a form with the GET method is visible to everyone. GET also has limits on the amount of information to send. The limitation is about 2000 characters. When to use 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. However, because the variables are not displayed in the URL, it is not possible to bookmark the page.

To create database and table How to run Program XAMPP (It contains MySQL , Apache and PHP) Start XAMPP control panel from window’s start menu and start Apache and MySQL Required Software Goto browser and type localhost/phpmyadmin To create database and table Use Notepad and give .php extension To write PHP code Save the .php file in XAMPP->htdocs folder->Any folder created by you-> save file with index.php Where to Save .php file go to web browser and write localhost/name_of_folder To run PHP program

Database handling using PHP Connection to MySQL // Create connection $conn = new mysqli(“localhost”, “root”, “”); //MySQLi extension (the "i" stands for improved) // Check connection if(!$conn){ die('Could not connect: '.mysqli_connect_error()); } echo 'Connected successfully<br/>'; ?>

Select Data From a MySQL Database <?php $conn = mysqli_connect(‘localhost’, ‘root’, ‘root’, ‘db1’); if(!$conn){ die(mysqli_connect_error()); } echo 'Connected successfully<br>'; $sql = 'SELECT * FROM STUD'; $rs=mysqli_query($conn, $sql); $nrows= mysqli_num_rows($rs);

Select Data From a MySQL Database if($nrows > 0){ while($row = mysqli_fetch_assoc($rs)){ echo "ID :{$row['id']} <br>"; echo "FNAME : {$row['firstname']} <br>"; echo "LNAME : {$row['lastname']} <br>"; echo "--------------------------------<br>"; } else { echo “ No result"; } mysqli_close($conn); ?>

References https://www.w3schools.com/php/php_intro.asp https://www.w3schools.com/php/php_forms.asp https://www.w3schools.com/php/php_mysql_intro.asp