Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

UFCE8V-20-3 Information Systems Development 3 (SHAPE HK) Lecture 3 PHP (2) : Functions, User Defined Functions & Environment Variables.
Introducing JavaScript
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 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
Objectives Using functions to organize PHP code
Tutorial 6 Working with Web Forms
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Simple Web SQLite Manager/Form/Report
Advertising Tool – Flash Requirements. Overall Requirements Develop a Flash application (Client and Server side) that combines and serves images on a.
JAVASCRIPT HOW TO PROGRAM -2 DR. JOHN P. ABRAHAM UTPA.
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.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Week 4  Using PHP with HTML forms  Form Validation  Create your own Contact form Please Visit:
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.
(c) Manzur Ashraf, Short course, KFUPM PHP & MySQL 1 Basic PHP Class 2.
INTERNET APPLICATION DEVELOPMENT For More visit:
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Lab Assignment 7 | Web Forms and Manipulating Strings Interactive Features Added In this assignment you will continue the design and implementation of.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Security Testing Case Study 360logica Software Testing Services.
Building PERL Scripts on a Windows system* *and running those scripts on an Apache server!
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
1 Session 3: Flow Control & Functions iNET Academy Open Source Web Programming.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Website Development with PHP and MySQL Saving Data.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
Chapter 2 Functions and Control Structures PHP Programming with MySQL 2 nd Edition.
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
CIS166AE : PHP Web Scripting Rob Loy. Tonight’s Agenda Housekeeping items Housekeeping items PHP basics PHP basics Student connection to server Student.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.
audio video object Options: controls autoplay Need to define height and width Options: controls autoplay.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
XP Tutorial 8 Adding Interactivity with ActionScript.
Server-Side Scripting with PHP ISYS 475. PHP Manual Website
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
Introduction to Perl. What is Perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Similar to shell script.
WEB FORM DESIGN. Creating forms for a web page For your web project you have to design a form for inclusion on your web site (the form information should.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Javascript JavaScript is what is called a client-side scripting language:  a programming language that runs inside an Internet browser (a browser is also.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
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.
Basic ActionScript and PHP Cis 126. Getting Started set up a basic folder structure so we can keep our files organized. Mirror this structure on your.
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.
PHP Form Processing * referenced from
NMD202 Web Scripting Week2. Web site
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.
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,
PHP Introduction.
PHP.
Web Application Development Using PHP
Presentation transcript:

Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy

Agenda Lab and homework review Lab and homework review Canvas Canvas Array Array Functions Functions PHP functions PHP functions Homework and presentation Homework and presentation

Canvas Goto Goto Use MEID/Password to log-in Use MEID/Password to log-in

First Things First When you come to class, download Filezilla to the desktop and install it! When you come to class, download Filezilla to the desktop and install it! Make sure it is the client piece Make sure it is the client piece

IMPORTANT NOTE All filenames lower case alphanumeric names.

Arrays An ordered arrangement of data elements. An ordered arrangement of data elements. Vector is a one dimensional array. Vector is a one dimensional array. Matrix is a two-dimensional array. Matrix is a two-dimensional array.

Numeric Array Syntax Creating an array: Creating an array:$a=array(“Cat",“Dog",“Bird",“Fish"); Accessing elements of an array. Note: the first element is location “0”. Accessing elements of an array. Note: the first element is location “0”. print(“ Element = “.$a[0].” \n”); Result: “Element = Cat” Result: “Element = Cat”

Associative Array Syntax Creating an array: Creating an array:$a=array(“Cat“=>4,“Dog“=>2,“Bird“=>7,“Fish“=>20); Accessing elements of an array. Accessing elements of an array. print(“ Element = “.$a[“Bird”].” \n”); Result: “Element = 7” Result: “Element = 7”

Multi Dimension Array Creating an array: $simpsons = array( array(“Homer", 35, 315), array(“Marge", 33, 125), array(“Bart", 11, 95)); Creating an array: $simpsons = array( array(“Homer", 35, 315), array(“Marge", 33, 125), array(“Bart", 11, 95)); Accessing elements: echo $simpsons[0][1] ; // Homer’s age Accessing elements: echo $simpsons[0][1] ; // Homer’s age

Multi Dimensional Array (adv) Creating array: $simpsons = array( array(Name => “Homer", Age => 35, Weight => 315), array( Name => “Marge", Age => 33, Number => 125), array( Name => “Bart", Age => 11, Number => 95)); Creating array: $simpsons = array( array(Name => “Homer", Age => 35, Weight => 315), array( Name => “Marge", Age => 33, Number => 125), array( Name => “Bart", Age => 11, Number => 95)); Accessing elements: echo $simpsons[0][“Age”] ; // Homer’s age Accessing elements: echo $simpsons[0][“Age”] ; // Homer’s age

Functions Definition: A self-contained software routine that performs a task. Definition: A self-contained software routine that performs a task. Functions can do a large amount of processing or as little as adding two numbers and deriving a result. Functions can do a large amount of processing or as little as adding two numbers and deriving a result. Values may be passed to a function. Values may be passed to a function. Values may be returned from a function. Values may be returned from a function.

Function Syntax function addnumbers ($a, $b) { $c = $a + $b; return $c; } addnumbers = function name addnumbers = function name $a and $b = localized variables [Parameters] $a and $b = localized variables [Parameters] return = sends value out if function return = sends value out if function

Function Flow $a = “rob”; $b = introduce(“Tom”); // Function CALL function introduce ($a) // Function DEFINITION { return “Hello “. $a; // Function RETURN } echo $b; RESULTS: Hello Tom

PHP Built-in Functions PHP natively has hundreds of functions created for use. PHP natively has hundreds of functions created for use. Users CAN NOT create functions that have the same name as the PHP functions. Users CAN NOT create functions that have the same name as the PHP functions. Functions could vary by server as some are tied to modules of PHP installed. Functions could vary by server as some are tied to modules of PHP installed. The default PHP built-in functions are listed at The default PHP built-in functions are listed at

PHP Array functions array_rand() Pick random entries out of an array array_rand() Pick random entries out of an array array_rand array_reverse() Return an array with elements in reverse order array_reverse() Return an array with elements in reverse order array_reverse array_sum() Calculate the sum of values in an array array_sum() Calculate the sum of values in an array array_sum

IMPORTANT NOTE A variable in a function is NOT the same as a variable inside a function even if they have the SAME name. This is called SCOPE.

PHP.NET The official PHP information website. The official PHP information website. User community of comments and questions and solutions. User community of comments and questions and solutions. Good examples. Good examples. ZEND owns the management of PHP. ZEND owns the management of PHP.

PHP.NET Site Examples Warnings User Content Explanations

PHP.NET References structures.php structures.php structures.php structures.php

IMPORTANT NOTE The life cycle in PHP is the length of time it takes the server to find the file, process the information, and send the completed static HTML back to the client.

PHP Require/Include require() pulls content from another file into the current file require() pulls content from another file into the current file All PHP code will run as if it was entered in the page from the beginning All PHP code will run as if it was entered in the page from the beginning include() and require() do the SAME thing except if the require can not find the file it is looking for the page stops loading include() and require() do the SAME thing except if the require can not find the file it is looking for the page stops loading There is also include_once() and require_once() which enforces loading the external content only once There is also include_once() and require_once() which enforces loading the external content only once

Require and Include Syntax require(“functions.php”); require(“functions.php”); include(“functions.php”); include(“functions.php”); include_once(“functions.php”); include_once(“functions.php”); include(“library\functions.php”); include(“library\functions.php”); There needs to be a file called functions.php in the SAME folder as the original file. There needs to be a file called functions.php in the “library” folder below the original file.

Questions?

Homework Create a folder called “assignment1” Create a folder called “assignment1” Rewrite the calculator program to utilize functions for the math functions. Rewrite the calculator program to utilize functions for the math functions. Add a function to check every input for a negative number and display the text “YOU CAN NOT ENTER A NEGATIVE.” Add a function to check every input for a negative number and display the text “YOU CAN NOT ENTER A NEGATIVE.” Add a function to check every math function input for a zero and display the text “YOU CAN NOT ENTER A ZERO!” Add a function to check every math function input for a zero and display the text “YOU CAN NOT ENTER A ZERO!” Send to with URL to calculator file before 6pm on September 26. Send to with URL to calculator file before 6pm on September

Presentation Select a PHP built-in function from ths quick reference page at Select a PHP built-in function from ths quick reference page at Send to with your PHP function choice before September 26. First come, first approved for functions! Send to with your PHP function choice before September 26. First come, first approved for Present your function syntax and sample on the screen Oct 10. Upload your code to your website and show results. Add some HTML text to show the syntax. Present your function syntax and sample on the screen Oct 10. Upload your code to your website and show results. Add some HTML text to show the syntax.

Sample PHP Presentation PHP Function Presentation Purpose: Pick a random element from an array. Syntax: $a=array(“Jan”,”Feb”,”Mar”,“Apr”, “May”); $b=array_rand($a); echo $b; Results:Feb