PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

Adding Dynamic Content to your Web Site
Chapter 31 Basic Form-Processing Techniques JavaServer Pages By Xue Bai.
Languages for Dynamic Web Documents
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
What is it? –Large Web sites that support commercial use cannot be written by hand What you’re going to learn –How a Web server and a database can be used.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
Multiple Tiers in Action
Apache Tomcat Server Typical html Request/Response cycle
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
Contrast with JavaScript HTML Formsto invoke Java Server Pages Structure of Forms Query strings Java Server Pages Sent From Browser To Serverfor JSP.
HTML Forms Piggy-back on Internet Programs Google example Validator example.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
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.
INTRO TO MAKING A WEBSITE Mark Zhang.  HTML  CSS  Javascript  PHP  MySQL  …That’s a lot of stuff!
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
August Chapter 1 - Essential PHP spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
INTERNET APPLICATION DEVELOPMENT For More visit:
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
MySQL in PHP – Page 1 of 17CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: MySQL in PHP Reading: Williams &
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Elements of ASP Documents Adapted from MCDN Web Workshop ( and Webmonkey’s Introduction to Active.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
Introduction to Applets CS 3505 Client Side Scripting with applets.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Website Development with PHP and MySQL Saving Data.
1 Welcome to CSC 301 Web Programming Charles Frank.
Overview: 1. Discussion of the basic architecture of a web application. 2. Discussion of the relevance of using MySQL and PHP in a web application.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
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.
CS1001 Lecture 9. Overview Security Security HTML HTML.
HTLM Forms CS3505. Form Handling in Browser html User Files out form WEbBROWSErWEbBROWSEr User read response submit Get URL?input html Get file html script.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Creating Databases for Web applications Server side vs client side PHP basics Homework: Get your own versions of sending working: both html and Flash!
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
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.
Creating PHP Pages Chapter 5 PHP Structure and Syntax.
Creating Databases applications for the Web: week 2 Basic HTML review, forms HW: Identify unique source for asp, php, Open Source, MySql, Access.
Servers- Apache Tomcat Server Server-side scripts- Java Server Pages.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
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.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
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.
PHP Overview. What is PHP Widely available scripting language Free Alternative to Microsoft’s ASP Runs on the Web Server; not in the browser Example:
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
Web Database Programming Using PHP
Introduction to Dynamic Web Programming
Web Database Programming Using PHP
Web Browser server client 3-Tier Architecture Apache web server PHP
PHP and Forms.
Tutorial 10: Programming with javascript
Presentation transcript:

PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools

client 1.Browser sends URL to request PHP page Web server 2. Server retrieves program (PHP) from storage 3. Sends results to client 4. Browser displays page - starts program - compiles (PHP) code - generates results Two-tier Software Architecture

Example – Times Table 1.Make HTML Form that sends integers M and N to PHP script. 2. PHP Script: Gets the Form data. Sends multiples from 1 * 1 … to M * N, to browser on successive lines.

Demonstrate HTML Form requests simple calculation m1.html m1.php HTML FormSends data Requests PHP execution PHP programGets data from Server Calculation HTML code Posted under Assgt02 directory Test with m1.html and data Test with m1.php directly

m1.html web.njit.edu retrieves m1.php results to client Browser renders page Gets M, N values compiles m1.php starts program Calculates based on input and sends results to browser m1.php show_source (“m1.php”) query-string ? M=2&N=2 submits Form program requested data for program Architecture of Example data

Code Overview

M N action="m1.php" activates Form: sends data to server asks server to execute m1.php Form data/variables PHP program requested HTML FORM LAYOUT

More HTML Initial HTML ?> More HTML <?php PHP statements here ; ?> <?php PHP statements here ; PHP File Layout fileName.php

body { background-color: cyan ; font-size:18pt ; } <?php ?> $M = $_GET[ "M" ]; $N = $_GET[ "N" ]; print "Here come the multiples! " ; for ( $i=1 ; $i <= $M; $i++ ) { print " " ; }; print "That's all folks " ; Gets data M & N from server PHP variables begin with $ Typical for-loop for ( $k=1 ; $k <= $N; $k++ ) Sends output stream to browser Code sends products 1*1.. M * N to browser Displays PHP code. Nested for-loop Intermingled HTML and text. show_source("m1.php"); HTML Form variable names PHP variable names PHP code Generates dynamic HTML See results in: View > Page Source {$x = $i * $k ; print "$i * $k = $x" ; print " " ; }

body { background-color: cyan ; font-size:18pt ; } <?php ?> $M = $_GET[ "M" ]; $N = $_GET[ "N" ]; print "Here come the multiples! " ; for ( $i=1 ; $i <= $M; $i++ ) { print " " ; }; print "That's all folks " ; Gets data M & N from server PHP variables begin with $ Typical for-loop for ( $k=1 ; $k <= $N; $k++ ) Sends output stream to browser Code sends products 1*1.. M * N to browser Displays PHP code. Nested for-loop Intermingled HTML and text. show_source("m1.php"); HTML Form variable names PHP variable names Generates dynamic HTML See results in: View > Page Source {$x = $i * $k ; print "$i * $k = $x" ; print " " ; } Replace with Link element And Style sheet

PHP Syntax checking Usually white screen of death signals PHP syntax error. /

Syntax checking - Client server block diagram HTML Form elements Query string Input Form– get & echo Input Form– MySQL insert Concepts Two tier architecture