Page 1 PHP, HTML, STATE Achmad Arwan, S.Kom. Page 2 PHP ( PHP: Hypertext Preprocessor) A programming language devised by Rasmus Lerdorf in 1994 for building.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

Powerpoint Templates Page 1 Powerpoint Templates Server Side Scripting PHP.
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK)
Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: The Basics.
Cookies, Sessions. Server Side Includes You can insert the content of one file into another file before the server executes it, with the require() function.
1 Chapter 5 – Handling HTML Controls in Web Pages spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
Chapter 10 Managing State Information PHP Programming with MySQL.
Web Page A page displayed by the browser. Website Collection of multiple web pages Web Browser: A software that displays web pages on client computer.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
MS3304: Week 4 PHP & HTML Forms. Overview HTML Forms elements refresher Sending data to a script via an HTML form –The post vs. get methods –Name value.
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.
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.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Lecture 7 – Form processing (Part 2) SFDV3011 – Advanced Web Development 1.
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.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
CHAPTER 12 COOKIES AND SESSIONS. INTRO HTTP is a stateless technology Each page rendered by a browser is unrelated to other pages – even if they are from.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
PHP. Why should we learn web programming? No need write socket programming. - You can forget TCP/IP & OSI layers. - Web server handles socket tasks for.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Week 9 PHP Cookies and Session Introduction to JavaScript.
Web Programming by Aryo Pinandito 01 – PHP Fundamentals and State.
Chapter 8 Cookies And Security JavaScript, Third Edition.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
Week seven CIT 354 Internet II. 2 Objectives Database_Driven User Authentication Using Cookies Session Basics Summary Homework and Project 2.
Chapter 6 Server-side Programming: Java Servlets
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
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.
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.
PHP. $_GET / $_POST / $_SESSION PHP uses predefined variables to provide access to important information about the server and requests from a browser.
COOKIES and SESSIONS. COOKIES A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each.
Server-Side Scripting with PHP ISYS 475. PHP Manual Website
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
Sessions and Cookies State Management, Cookies, Sessions, Hidden Fields SoftUni Team Technical Trainers Software University
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
SESSIONS 27/2/12 Lecture 8. ? Operator Similar to the if statement but returns a value derived from one of two expressions by a colon. Syntax: (expression)
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
PHP Form Processing * referenced from
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.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 3 PHP Advanced.
Unit-6 Handling Sessions and Cookies. Concept of Session Session values are store in server side not in user’s machine. A session is available as long.
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,
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
IN THIS LESSON WE WILL REVIEW THE STRUCTURE OF THE INTERNET AND HOW BROWSERS ASSEMBLE WEBSITES BASED ON INSTRUCTIONS THEY RECEIVE FROM SERVERS. Internet.
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 – Hypertext Preprocessor.
PHP using MySQL Database for Web Development (part II)
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
19.10 Using Cookies A cookie is a piece of information that’s stored by a server in a text file on a client’s computer to maintain information about.
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
PHP Introduction.
Intro to PHP.
PHP-II.
Presentation transcript:

Page 1 PHP, HTML, STATE Achmad Arwan, S.Kom

Page 2 PHP ( PHP: Hypertext Preprocessor) A programming language devised by Rasmus Lerdorf in 1994 for building dynamic, interactive Web sites. Cross-platform: Most PHP code can be processed without alteration on computers running many different operating systems. For example, a PHP script that runs on Linux generally also runs well on Windows. HTML-embedded: PHP code can be written in files containing a mixture of PHP instructions and HTML code.

Page 3 PHP ( PHP: Hypertext Preprocessor) Server-side: The PHP programs are run on a server—specifically a Web server. Web-scripting language: PHP programs run via a Web browser. Case Sensitive

Page 4 System requirement To run php code you will need at least the following software: 1.Server software (an operating system such as Windows 7 or Linux) 2.A PHP-compatible Web server (such as Apache or Internet Information Server (IIS) 3.PHP5 (get the download from 4.A relational database system (we use SQLite or MySQL) 5.A Web browser (such as IE, Mozilla, and so on) 6.A text editor, such as Notepad, Emacs, vi, BBEdit, and so on.

Page 5 Hello.php PHP Test Hello World '; ?>

Page 6 Variables Issues concerning creating variables: 1.Naming 2.Data type 3.Scope

Page 7 Naming Variables 1.Variable names begin with a dollar sign ($). 2.The first character after the dollar sign must be a letter or an underscore. 3.The remaining characters in the name may be letters, numbers, or underscores without a fixed limit example <?php $my_first_variable = 0; ?>

Page 8 PHP Data Types Data typeDescription BooleanScalar; either True or False IntegerScalar; a whole number FloatScalar; a number which may have a decimal place StringScalar; a series of characters ArrayCompound; an ordered map (contains names mapped to values) ObjectCompound; a type that may contain properties and methods ResourceSpecial; contains a reference to an external resource, such as a handler to an open file NULLSpecial; may only contain NULL as a value, meaning the variable; explicitly does not contain any value

Page 9 Operators OperatorName Descriptio n ExampleResult x + yAddition Sum of x and y x - ySubtraction Difference of x and y x * y Multiplicatio n Product of x and y 5 * 210 x / yDivision Quotient of x and y 15 / 53 x % yModulus Remainder of x divided by y 5 % 2 10 % 8 10 % xNegation Opposite of x - 2

Page 10 Operators _operators.asphttp:// _operators.asp

Page 11 Variable Scope Local Scope –Any Variable used inside function –<? function send_data() { – $my_data = "Inside data"; – echo $my_data; } ?> Global Scope –Any variable outside function –<?php $a = 1;$b = 2; function Sum() { global $a, $b; $b = $a + $b; } echo $b; ?>

Page 12 Super Global arrays ArrayDescription $GLOBALSHas a reference to every variable that has global scope in a PHP program. Many of the variables in it are also in other superglobal arrays $_SERVERIncludes everything sent by server in the HTTP response, such as the name of the currently executing script, server name, version of HTTP, remote IP address, and so on. Although most Web server software produces the same server variables, not all do, and not all server variables necessarily have data in them $_GETContains all the querystring variables that were attached to the URL, or produced as a result of using the GET method $_POSTContains all the submitted form variables and their data. You use variables from the $_POST or $_REQUEST arrays extensively in most of your PHP programs. For example, to make use of a username or password (or any other data) submitted as part of a form, you'll use PHP variables from the $_REQUEST array

Page 13 Super Global arrays ArrayDescription $_COOKIEContains all cookies sent to the server by the browser. They are turned into variables you can read from this array, and you can write cookies to the user's browser using the setcookie() function. Cookies provide a means of identifying a user across page requests (or beyond, depending upon when the cookie expires) and are often used automatically in session handling $_FILESContains any items uploaded to the server when the POST method is used. It's different from the $_POST array because it specifically contains items uploaded (such as an uploaded image file), not the contents of submitted form fields $_ENVContains data about the environment the server and PHP are operating in, such as the computer name, operating system, and system drive $_REQUESTContains the contents of the $_GET, $_POST, and $COOKIE arrays, all in one

Page 14 Query String Sometime, you could write a PHP program that generates a query string attached to a URL using code such as this (assuming you had the $first_name and $last_name variables already set): Ex: ">Click Here When this code runs, it produces the following output: Click Here

Page 15 Attributs Forms Elements Action Attribute –Tells to server which page to go to... Method Attribute –The method attribute controls the way that information is sent to the server. or

Page 16 Get Value Browser automatically appends the information to the URL when it sends the page request to the web server Ex If submit clicked then page will redirect to al=porcupine ??

Page 17 URL Encoding CharacterURL Encoding Tab%09 Space%20 !%21 "%22 #%23 %25 &%26 (%28 )%29 +%2B,%2C.%2E /%2F :%3A ;%3B <%3C >%3E =%3D \%5C

Page 18 Post Value Information in the form is sent in the body of http request and doesn’t appear in the url

Page 19 HTML Form Fields Text Fields – Password Field – Radio Buttons – Checkboxes – Submit Button – Hidden fields –

Page 20 PHP Form Handling Get Value – Welcome ! Your password is. Post Value – Welcome ! Your password is.

Page 21 Concept of State How to keep login on facebook while you browse your friends profiles How to keep your shopping cart while you browse your favorite goods

Page 22 COOKIES A cookie is a small file that the server embeds on the user's computer. A cookie is often used to identify a user. Web sites can usually only modify their own cookies.

Page 23 COOKIES Set cookies –setcookie(name, value, expire, path, domain); – Retrieve cookies –$_COOKIE[“name cookie"]; –

Page 24 SESSIONS With Session user allowed to store information on the server for later use (i.e username, shopping item). Session information is temporary and will be deleted after the user has left the website. Sessions work by creating a unique id (UID) for each visitor and store variables based on this UID.

Page 25 SESSIONS Starting session – Storing session – Retrieve session Destroy Session