Website Development & Management More PHP Odds & Ends Instructor: John Seydel, Ph.D. CIT 3353 -- Fall 2006 www.clt.astate.edu/jseydel/mis3353.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Arrays.
PHP for Server-Side Preprocessing Chapter 08. Overview and Objectives Present a brief history of the PHP language Discuss how PHP fits into the overall.
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
NUMERIC ARRAYS DEBBI HAMNER CIT 336 TEACHING PRESENTATION.
PHP (2) – Functions, Arrays, Databases, and sessions.
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic PHP.
Information Technology Center Hany Abdelwahab Computer Specialist.
Tutorial 11 Working with Operators and Expressions
Website Development & Management PHP Odds & Ends Instructor: John Seydel, Ph.D. CIT Fall
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
PHP: Hypertext Processor Fred Durao
Website Development & Management Introduction & Overview CIT Fall Instructor: John Seydel, Ph.D.
NMD202 Web Scripting Week1. Contact Information – Lecturer is a part time member of staff. Students are encouraged to use.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 26 - PHP Outline 26.1 Introduction 26.2 PHP 26.3 String Processing and Regular Expressions 26.4.
Institute of New Media Development & Research Prabhat Road, Lane No 5, Opp. Lijit Papad, Above OBC Bank, 1st Floor, Pune Web site :
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 26 - PHP Outline 26.1 Introduction 26.2 PHP 26.3 String Processing and Regular Expressions 26.4.
Website Development & Management More PHP Fundamentals CIT Fall Instructor: John Seydel, Ph.D.
Homework for October 2011 Nikolay Kostov Telerik Corporation
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 11 - JavaScript: Arrays Outline 11.1 Introduction 11.2 Arrays 11.3 Declaring and Allocating Arrays.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
CISC474 - JavaScript 03/02/2011. Some Background… Great JavaScript Guides: –
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
Website Development & Management Creating Web Pages CIT Fall Instructor: John Seydel, Ph.D.
Website Development & Management Getting Started with Databases Instructor: John Seydel, Ph.D. CIT Fall
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Using Client-Side Scripts to Enhance Web Applications 1.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
Java Script: Arrays (Chapter 11 in [2]). 2 Outline Introduction Introduction Arrays Arrays Declaring and Allocating Arrays Declaring and Allocating Arrays.
Advanced PHP & RSS Utilizing XML, RSS, and PHP. XML (eXtensible Markup Language) XML is the language of all RSS feeds and subscriptions XML is basically.
1 Chapter 9 – Cookies, Sessions, FTP, and More spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
ITCS373: Internet Technology Lecture 5: More HTML.
Electronic Commerce Server-Side Scripting Exercises MIS Spring 2006 Instructor: John Seydel, Ph.D.
Web Programming Language Week 5 Dr. Ken Cosh Introducing PHP 1.
Intro to PHP Carl-Erik Svensson. What is PHP? PHP is a widely-used general-purpose scripting language that is especially suited for Web development and.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.
Website Development & Management A PHP Exercise CIT Fall Instructor: John Seydel, Ph.D.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
2016 N5 Prelim Revision. HTML Absolute/Relative addressing in HTML.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
Form Processing Week Four. Form Processing Concepts The principal tool used to process Web forms stored on UNIX servers is a CGI (Common Gateway Interface)
MySQL MySQL and PHP – interacting with a database.
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.
Website Development & Management Some Wrap-Up Items Instructor: John Seydel, Ph.D. CIT Fall
PHP Syntax You cannot view the PHP source code by selecting "View source" in the browser - you will only see the output from the PHP file, which is plain.
Introduction to PHP 1.What is PHP? What Is PHP?  php: hypertext preprocessor  Server-side scripting language—like ASP—scripts are executed on server.
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.
Variable Variables A variable variable has as its value the name of another variable without $ prefix E.g., if we have $addr, might have a statement $tmp.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
Chapter 5 Murach's JavaScript and jQuery, C1© 2012, Mike Murach & Associates, Inc.Slide 1.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
5 Copyright © 2004, Oracle. All rights reserved. PL/SQL Server Pages.
PHP using MySQL Database for Web Development (part II)
Website Development & Management
JavaScript is a programming language designed for Web pages.
Chapter 19 PHP Part II Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice Hall ©
Intro to PHP & Variables
PHP.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
[Robert W. Sebesta, “Programming the World Wide Web
JavaScript Basics What is JavaScript?
PHP PART 2.
PHP an introduction.
Presentation transcript:

Website Development & Management More PHP Odds & Ends Instructor: John Seydel, Ph.D. CIT Fall

Student Objectives Upon completion of this class meeting, you should be able to: Create an onLoad event handler for a web page Use the foreach() construct to loop through an array of data Use ereg() to validate addresses Use switch() in place of the if()/elseif() construct Discuss how data are stored and processed using arrays

Some Other Things (continued) Note some things in the FKAuto calculator page (calc.php) JavaScript Arrays foreach() construct Review and enhancement of handling Replace if() construct with switch() construct Check for a valid address  Use ereg() Case-sensitive; use eregi() for case-insensitive Alternative to preg_match(), which is a Perl-compatible function  Search for an “at” symbol  Syntax: Add onLoad event handler to Review and revision of the script writing processprocess

What We’ve Looked at Today Using JavaScript to create an onLoad event handler How for() and foreach() constructs work The ereg() function Comparison of switch() and if()/elseif() Array concepts

Appendix

Arrays Creating a simple array $arrTerm = array(2,3,4,5,6,7); or $arrTerm = range(2,7); This is an indexed array For element $arrTerm[0]  Index is 0  Value is 2 For element $arrTerm[5]  Index is 5  Value is 7 To add an element: $arrTerm[6] = 8; or array_push($arrTerm,8); The number of array elements is count($arrTerm)

Associative Arrays Creating an associative array $arrCustomer[‘Person’] = “Jenny”; $arrCustomer[‘Phone’] = “ ”; or $arrCustomer = array(“Person”=>”Jenny”,”Phone”=>” ”); Array contents For element $arrCustomer[’Person’]  Name is Person  Value is Jenny For element $arrCustomer[’Phone’]  Name is Phone  Value is Some typical associative arrays Form data, e.g., $_POST[‘txtCustomer’] and other elements Database recordset rows; e.g., $strResult[‘Model’] and other

Review: Sending Makes use of the mail() function String Arguments accepted: Recipient Subject Message Header  From (overrides value specified in php.ini)  Reply-to  Other... Consider a one-line example (poor coding)

Process Guidelines for Writing Scripts: Original Recommendation Start by initializing Assign initial values to variables Define constants if any Get data From form From other sources Prepare data for processing Write the processing logic Branching as appropriate Calculations as appropriate String manipulations as appropriate Other processing (e.g., send mail, write to database,... ) Format results for output as appropriate

Revised Script Writing Process Prior to the XML/HTML Initialization Get data  From forms and other sources (but not databases)  Validate as appropriate After and before Prepare data for processing Get data from database Write the processing logic  Branching, calculations, and string manipulations as appropriate  Other processing (e.g., send mail, write to database,... ) Other database queries Format results for output as appropriate Within and, limit PHP to scriptlets that display pre-generated HTML output blocks