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

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: Moving On..
CHAPTER 3 MORE ON FORM HANDLING INCLUDING MULTIPLE FILES WRITING FUNCTIONS.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Tutorial 6 Working with Web Forms
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
Python and Web Programming
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.
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
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: Introduction By Trevor Adams.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
PHP == ‘ Hypertext Preprocessor ’ Open-source, server-side scripting language Used to generate dynamic web-pages PHP scripts reside between reserved PHP.
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.
CSC 405: Web Application And Engineering II 2.1 Web Programming with PHP Introduction to Web programming Introduction to Web programming The programming.
(c) Manzur Ashraf, Short course, KFUPM PHP & MySQL 1 Basic PHP Class 2.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
2010/11 : [1]Building Web Applications using MySQL and PHP (W1)PHP Recap.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Chapter 4 JavaScript and Dynamic Web pages. Objectives Static Web pages Dynamic Web pages JavaScript Variables Assignments. JavaScript Functions –(prompt(“”,””)
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
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.
Lecture-2 Operators and Conditionals. Variables(again???) Type: Representation of “bits” in memory Variables: Name for a memory object. Starts with letters,
PHP - Basic Language Constructs CSCI 297 Scripting Languages - Day Two.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
HTML : Forms, Frames Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
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.
Web Technology Introduction to PHP. PHP PHP stands for PHP Hypertext Preprocessor PHP is a Server-Side Web Scripting language, which executes on the web.
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.
3 1 Sending Data Using an Online Form CGI/Perl Programming By Diane Zak.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
XP Tutorial 8 Adding Interactivity with ActionScript.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
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 a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
January 2006Colby College ITS Setting Up Course Pages.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
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.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
CSC 405: Web Application Engineering II 2.1 Web Programming with PHP Introduction to Web programming Introduction to Web programming The programming language.
Scripting with Client-Side Processing Scripting with Client Side Processing Lesson – Web Technologies Copyright © Texas Education Agency, All rights.
PHP Form Processing * referenced from
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
HTML FORM Lab Exercise IST Guideline Add forms in your web page so that visitors can add a comment about your web page Forms should include the.
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 PHP.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
A little PHP. Enter the simple HTML code seen below.
A little PHP.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Chapter 2 Client/Server Applications
PHP Hypertext Preprocessor
PHP Introduction.
Intro to PHP & Variables
HTML Forms and User Input
More Selections BIS1523 – Lecture 9.
PHP-II.
Introduction to JavaScript
Presentation transcript:

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

Agenda Review homework & lab Review homework & lab Tools (Eclipse) Tools (Eclipse) PHP branching PHP branching PHP looping PHP looping In-class calculator In-class calculator Lab Lab

IMPORANT DEFINITIONS Client –Computer that uses the services of another computer. A browser is an example of a client program. Client –Computer that uses the services of another computer. A browser is an example of a client program. Server –Computer program that delivers (serves) content over the World Wide Web. Server –Computer program that delivers (serves) content over the World Wide Web.

Using mySCC Use your desktop credentials

Using mySCC CIS-BPC folder contains the Eclipse and Filezilla applications. My_Documents contains the contents of the student H: drive.

IMPORTANT NOTE All filenames lower case alphanumeric names.

Eclipse

Syntax Validation in Eclipse Red “squiggly” lines indicate an expected syntax error. Although not all syntax errors are caught. Notice missing closing “ but no syntax errors shown.

PHP Syntax “Hello” “Hello” ‘Hello’ ‘Hello’ ; { } { } print( ) print( ) \.

PHP <html><body><?php print(“ This is text. \n”); ?></body></html>

IMPORTANT NOTE PHP files must have the extension.php and be uploaded to a web server capable of serving up PHP files.

PHP and HTML HTML can be included within PHP text /strings. HTML can be included within PHP text /strings. To format the VIEW SOURCE, add the \n for line breaks. This has no impact on the user experience. To format the VIEW SOURCE, add the \n for line breaks. This has no impact on the user experience. print(“ This is text. \n”);

PHP Variables and HTML $a = “Rob”; print(“ Hello “.$a.”. \n”); You can add variables to text by concatenating the string with “.”. You can add variables to text by concatenating the string with “.”. First exit the string using a “ then add the variable then return to the string using another “. First exit the string using a “ then add the variable then return to the string using another “.

IMPORTANT NOTE x = y does not compare x to y but instead sets y equal to x. Instead use x==y for comparison. x = y does not compare x to y but instead sets y equal to x. Instead use x==y for comparison.

Logic Structures Conditional Conditional if … then … elseif if … then … elseif switch/case statements switch/case statements Loops Loops for … next for … next do … while do … while

If …Then Statements $d=“Rob”; if ($d==“Rob”) { print("Hello! \n"); } else { print(“Goodbye! \n"); }

Switch/Case Statements $d=“Rob”; switch ($d) { case “Rob”: print(“ Hello Cuz! \n"); break; case “Tom”: case “Tom”: print(“ Hello Bro! \n"); break; default: print(“ Hello Who? \n"); }

IMPORTANT NOTE For LOOPS, must have an achievable test case to avoid endless loops. Need to know the test scenario. For LOOPS, must have an achievable test case to avoid endless loops. Need to know the test scenario.

For … Next Statements for ($i=1; $i I equals: ".$i." \n“); }

Do … While Statements $i=1; while($i Number is ".$i. " \n“); $i++; }

HTML Forms Name: Name: Greeting: Greeting: </p></form>

HTML Form Syntax Form method: How the information goes. Form method: How the information goes. GET = in the URL string GET = in the URL string POST = in HTTP Header (preferred) POST = in HTTP Header (preferred) Form action: Where the information goes. Form action: Where the information goes. Input name: How the information is stored (“variable” name) Input name: How the information is stored (“variable” name)

Form data and PHP Code to access in the information goes in the page named in the action. Code to access in the information goes in the page named in the action. input type="text" name=“name" /> To get the value entered, the method type and input name are used: To get the value entered, the method type and input name are used: print(“ Name was “. $_POST[“name”]. “ \n”);

HTML Drop-downs HTML drop-downs have names and values HTML drop-downs have names and values Orange Orange Red Red Black Black </select> To access the information you use the form “name” To access the information you use the form “name” $a = $_POST[“mylist”];

HTML Radio Buttons Radio buttons only have values and names. Radio buttons only have values and names. If the names are the same, only ONE button can be selected at a time. If the names are the same, only ONE button can be selected at a time To access the information you use the form “name” To access the information you use the form “name” $a = $_POST[“op”];

Updating HTML using PHP ” /> ” /> Short blocks of PHP can be inserted in to HTML. Short blocks of PHP can be inserted in to HTML. print(“ \n”); Entire HTML lines can be created within PHP by mixing “ and ‘ quote marks. Entire HTML lines can be created within PHP by mixing “ and ‘ quote marks. print(“ \n”); Entire HTML lines can be created within PHP by using literal markings (\). Entire HTML lines can be created within PHP by using literal markings (\).

In-class Calculator

HTML Calculator Lessons: 1.print 2.$_POST 3.if … then 4.switch/case

PHP Operators - Math + - Addition + - Addition - - Subtraction - - Subtraction * - Multiplication * - Multiplication / - Division / - Division % - Modulus (division remainder) % - Modulus (division remainder)

Logic for calculator User inputs TWO numbers User inputs TWO numbers User selects the math function User selects the math function User clicks submit User clicks submit Depending on the function selected, process the TWO numbers Depending on the function selected, process the TWO numbers Display the result Display the result Send the user back to the initial screen Send the user back to the initial screen

Questions?

Lab Complete the calculator functions for Multiple and Divide and add buttons/functionality for square root [sqrt($x)] and square [pow($x, 2) ] of field1. Complete the calculator functions for Multiple and Divide and add buttons/functionality for square root [sqrt($x)] and square [pow($x, 2) ] of field1. Move the files to a new folder called homework2. Move the files to a new folder called homework2. Send to Rob Loy with URL before 6pm on September 19. Send to Rob Loy with URL before 6pm on September