Creating Databases for Web applications Server side vs client side PHP basics Homework: Get your own versions of sending email working: both html and Flash!

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

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.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
PHP Intro/Overview Squirrel Book pages Server-side Scripting Everything you need to know in one slide 1.Web server (with PHP “plug-in”) gets a.
HTML Form Processing Learning Web Design – Chapter 9, pp Squirrel Book – Chapter 11, pp
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
Web Programming Introduction to PHP COM Objectives To understand what PHP is and how a PHP script works with a Web Browser and a Web Server To learn.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Creating Databases applications for the Web Reprise. Basic HTML review, forms Preview: Server side vs client side Classwork: create HTML forms and check.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
PHP: Hypertext Processor Fred Durao
ALBERT WAVERING BOBBY SENG. Week Whatever: PHP  Announcements/questions/complaints.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
PHP : Hypertext Preprocessor
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
Lecture 7 Interaction. Topics Implementing data flows An internet solution Transactions in MySQL 4-tier systems – business rule/presentation separation.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
A little PHP. Enter the simple HTML code seen below.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
USING PERL FOR CGI PROGRAMMING
CIS 451: ASP.NET Objects Dr. Ralph D. Westfall January, 2009.
Creating Databases for Web Applications Reprise: Systems design (diagrams) Flash to php Homework: Prepare for quiz.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
Website Development with PHP and MySQL Saving Data.
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.
Creating databases for Web Applications php basics. ing. phpMyAdmin to set up MySQL. Homework: Use phpMyAdmin. Make posting with [unique] source on.
Continue with behavioral marketing. Tweets. Reports. Homework: capture tweets project.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Introduction to PHP Advanced Database System Lab no.1.
Creating Databases applications for the Web Basic HTML review, forms Preview: Server side vs client side Flash HW: Review HTML forms and FLASH examples.
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.
Introduction to JavaScript CS101 Introduction to Computing.
XP Tutorial 8 Adding Interactivity with ActionScript.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
 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.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Introduction to PHP Brendan Knight. What is PHP PHP is a general-purpose scripting language originally designed for web development to produce dynamic.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
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,
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
PHP: Further Skills 02 By Trevor Adams. Topics covered Persistence What is it? Why do we need it? Basic Persistence Hidden form fields Query strings Cookies.
A little PHP. Enter the simple HTML code seen below.
Web Database Programming Using PHP
Creating databases for Web Applications
A little PHP.
PHP (Session 1) INFO 257 Supplement.
Creating Databases Local storage. join & split
Web Database Programming Using PHP
PHP / MySQL Introduction
PHP Introduction.
Intro to PHP & Variables
Web Browser server client 3-Tier Architecture Apache web server PHP
PHP Intro/Overview Bird Book pages 1-11,
Tutorial 10: Programming with javascript
An Introduction to JavaScript
PHP Forms and Databases.
Intro to Programming (in JavaScript)
Presentation transcript:

Creating Databases for Web applications Server side vs client side PHP basics Homework: Get your own versions of sending working: both html and Flash!

PHP php files are interpreted by/on/at the server. One or more of the following happens: –php interface to operating system is used to do things such as interact with databases OR files OR –HTML is produced (and sent to the client) –cookie is set and/or accessed

Structure CLIENT Browser (Firefox): Requests URL SERVER PHP interpreter SERVER DBMS (MySQL) Build HTML page

Mechanics in php script Need to distinguish html versus php Common task will be to generate a string (aka character string) made up of html you know ahead of time and html generated from variables.

phpinfo script PHP info test <? echo phpinfo(); ?>

Variables Concept in all computing Variable 'is' a name that holds a value. Can be used in place of a literal value. The value can vary over use PHP: variable names begin with $, no spaces, avoid punctuation except for _ Rule: long enough for you to remember what it is used for and short enough to type.

php example Test Welcome to the store <?php …. Print(" New Products "); Print( " "+$newproduct1name); ?> Variable set & used

php variables within strings For all php variables, you can put the variable name in a string: print("The name input was: $fname"); –php figures out that $fname is a variable and gets its value. NOTE: out of habit in using other programming languages, sometimes I don't do that: print ("The name input was :". $fname); NOTE: the string concatenation operator is. Caution: SQL often requires a single quotation mark

Form data in php Built-in functions $_GET[' '] $_PUT[' '] If you want to NOT distinguish (considered less secure) $_REQUEST[' '] Name in form

Checking if a form variable has been set Common situation to check if this is first time Prevents error if no value exists

random rand (a, b) returns a pseudo-random choice from a to b, inclusive $choice=rand(0, sizeOf($states)-1); The arrays in php (like JavaScript and ActionScript) start indexing at zero.

Overview Useful to think in terms of 3 language domains (my terminology): –client side browser (interpreter of html) –server side interpreter of asp/JavaScript or php (There is another level here for the operating system, but this is what the asp objects and the php built-in functions & variables provide.) –database interpreter of SQL (by Access or MySQL)

Warnings Applicable to php and other languages: To output quotation marks in the HTML, you may use single quotes or 'escape' double quotation marks: print (" "); Response.Write(" "); SQL statements require quotation marks around values in certain cases. SQL statements use a single equals sign (=) for checking for equality. asp/JavaScript and php use == in IF statements.

php file for sending Note: this file can be used from HTML and from Flash / ActionScript Must execute on server Could use post or get [or $_REQUEST] This is what is used in Catching Bo

send .php <?php $to = $_POST['to']; $subject = $_POST['subject']; $body = $_POST['body']; $headers = "From: ". $_POST['from']; if (mail($to, $subject, $body,$headers)) { echo("Your message was sent"); } else { echo("There was a problem."); } /* message is send even if (s) not good! */ ?>

Extra credit possibility Figure out how to get an error Note: the use of mail is an asynchronous operation: initiated from php (sent to operating system on the server)

Look at Flash Download source of Catching Bo s30/chasebothedog a.flahttp://newmedia.purchase.edu/~Jeanine/a s30/chasebothedog a.fla

Look at html html .htmlhttp://newmedia.purchase.edu/~Jeanine/db/ html .html Note use of textarea element for multiline input

HTML Send From To Subject Body

Homework Implement your versions of BOTH the HTML and the Flash for sending Note: need to upload the send .php file and the.html file and the swf and html file published from FLASH