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

Slides:



Advertisements
Similar presentations
Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: Moving On..
Advertisements

Javascript Introduction Norman White Material is from w3schools.com Go there to run examples interactively.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
CIS101 Introduction to Computing Week 08. Agenda Your questions JavaScript text Resume project HTML Project Six This week online Next class.
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
Python and Web Programming
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
CIS101 Introduction to Computing Week 09 Spring 2004.
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.
Lesson 13: Building Web Forms Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver CS6.
2010/11 : [1]Building Web Applications using MySQL and PHP (W1)PHP Recap.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Tutorial 1 Getting Started with Adobe Dreamweaver CS3
A little PHP. Enter the simple HTML code seen below.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Using Client-Side Scripts to Enhance Web Applications 1.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
PHP - Basic Language Constructs CSCI 297 Scripting Languages - Day Two.
PHP2. PHP Form Handling The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. Name: Age:
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
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.
CIS133: Internet Development Week 2. Agenda  Homework Review  MYSCC  FTP  HTML Code  In-class  Lab / Homework.
PHP Teppo Räisänen LIIKE/OAMK PHP PHP is a programming language for making dynamic and interactive Web pages.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
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.
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.
Creating Databases for Web applications Server side vs client side PHP basics Homework: Get your own versions of sending working: both html and Flash!
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
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
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.
CGS 3066: Web Programming and Design Spring 2017
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
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
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

Tools Filezilla (FTP) (client download) Filezilla (FTP) (client download) PHP Programming PHP Programming

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(“ \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 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”];

PHP Redirect To send the user to another page, you can redirect them… To send the user to another page, you can redirect them… header(“location:newpage.php”); header(“location:newpage.php”);

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

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”);

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 (\).

Questions?

Lab Make an HTML page that the user inputs a number. Make an HTML page that the user inputs a number. When the user clicks submit the screen should display all the odd numbers between 0 and the number inputted. When the user clicks submit the screen should display all the odd numbers between 0 and the number inputted. Send to Rob Loy with URL to homework1a.php before 6pm on September 21. Send to Rob Loy with URL to homework1a.php before 6pm on September 21.

Homework Create a folder called homework2. Create a folder called homework2. Copy all the files for the calculator to that folder. Copy all the files for the calculator to that folder. Add to the class project to create functionality for MULTIPLICATION and DIVISION. Add to the class project to create functionality for MULTIPLICATION and DIVISION. Send to Rob Loy with URL to calculator file before 6pm on September 21. Send to Rob Loy with URL to calculator file before 6pm on September 21.