Email. If the PHP server is an email server or is aware of which server is the email server, then one can write code that emails information. –For example,

Slides:



Advertisements
Similar presentations
How to Create a Local Collection
Advertisements

JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
DT211/3 Internet Application Development JSP: Processing User input.
JavaScript Forms Form Validation Cookies CGI Programs.
PHP Form Processing. Using Forms in PHP  Two steps to process  Display the form  Process the submitted data.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
Tutorial 10 Programming with JavaScript
JAVASCRIPT TIPS. REMEMBER JAVASCRIPT IS VERY, VERY CASE SENSITIVE.
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
PHP Form Processing. Using Forms in PHP  Two steps to process  Display the form  Process the submitted data.
15. User Authentication, Form Validation, Paging. M. Udin Harun Al Rasyid, S.Kom, Ph.D
Logins  You will need PHP to test this code, all modern web hosting companies will provide this, Lehigh does not.  I've given you an account on des170.com:
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
JavaScript Form Validation
PHP : Hypertext Preprocessor
1 Chapter 6 – Creating Web Forms and Validating User Input spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Form Handling.
(c) Manzur Ashraf, Short course, KFUPM PHP & MySQL 1 Basic PHP Class 2.
HTML Forms What is a form.
Department of Information Technology e-Michigan Web Development 0 HTML Form Creation in the Vignette Content Management Application.
Create an online booking system (login/registration)
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 9 Scott Marino.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Project Four Forms Discuss form processing Describe the difference between client-side and server-side form processing Add a horizontal rule to a Web page.
PHP Hypertext PreProcessor. Documentation Available SAMS books O’Reilly Books.
Author: DoanNX Version 2.0/Time: 30’. The ways to solve it There are 2 main ways:  Client-side: Using JavaScript (now one very good option is JQuery).
Homework for October 2011 Nikolay Kostov Telerik Corporation
Faculty of Sciences and Social Sciences HOPE JavaScript Validation Regular Expression Stewart Blakeway FML
Week 7. Lecture 3 PHP Forms. PHP forms In part 2 of this course, we discussed html forms, php form is similar. Lets do a quick recap of the things we.
A little PHP. Enter the simple HTML code seen below.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 3.
G053 - Lecture 16 Validating Forms Mr C Johnston ICT Teacher
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
NMD202 Web Scripting Week3. What we will cover today Includes Exercises PHP Forms Exercises Server side validation Exercises.
CS 174: Web Programming September 30 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
COMPUTER PROGRAMMING. Functions What is a function? A function is a group of statements that is executed when it is called from some point of the program.
Yet more on XSLT. Regular expression handling in EXSLT We saw that the EXSLT extensions are divided into a group of modules, each of which has its own.
PHP Form Introduction Getting User Information Text Input.
Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.
If statements and validation. If statement In programming the if statement allows one to test certain conditions and respond differently depending on.
HTML ( HYPER TEXT MARK UP LANGUAGE ). What is HTML HTML describes the content and format of web pages using tags. Ex. Title Tag: A title It’s the job.
JavaScript Syntax, how to use it in a HTML document
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
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.
Part 2 Lecture 9 PHP Superglobals and Form Handling.
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Validation using Regular Expressions. Regular Expression Instead of asking if user input has some particular value, sometimes you want to know if it follows.
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)
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
ASSIGNMENT POINTS DUE DATE: Monday NOV 30 JAVASCRIPT, INPUT VALIDATION, REGEX See 2 nd slide for Form See 3 rd next slide for the required features.
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
Radio Buttons. Input/Form/Radio Group Use the dialog to enter label and values for the radio buttons.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
1 Week 8 Final Project Planning & Chapter 6 JavaScript Advanced Web Development IT225 Spring Term 2016 Marymount University School of Business Administration.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
A little PHP. Enter the simple HTML code seen below.
A little PHP.
Web Programming– UFCFB Lecture 17
Validation using Regular Expressions
Presentation transcript:

If the PHP server is an server or is aware of which server is the server, then one can write code that s information. –For example, an confirmation (Don’t become a spammer.) (Be careful about ing sensitive inofrmation.)

Design of a form

Display code (no yet)

Result so far (no yet)

Searching for an regular expression (at

Pick one with a good rating

Client-side validation

Client-side validation (Cont.) var = document.getElementById("txt ").value; = .replace(/^\s+|\s+$/g, ''); Get the string entered by the user from text field Use the string function replace and the regular expression for white space to make a JavaScript version of the trim function. (// format.php)

Client-side validation (Cont.) var Pattern = new 9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))$/); Declare and initialize a JavaScript regular expression. –Source: –Author: David Lott

Client-side validation (Cont.) if(! .match( Pattern)) { alert("Please enter a proper ."); return false; } Do not send information to server if the user’s does NOT (!) match the pattern regular expression.

Server-side: code

Server-side: code (Cont.) 9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))$/",$ )) { print " You entered an invalid and we cannot confirm for registration. "; } Validate using regular expression. Remember never rely on your client-side validation – you need to validate on the server side as well.

Server-side: code (Cont.) else { //used below in $extra $extra = "from: $return_address\nContent-type: text/html; charset=iso "; $subject = "ACT Training Registration Confirmation"; If the is valid, prepare some variable that will be used by the mail function Note that the return address becomes part of a longer variable that indicates that the ’s body will use HTML formatting.

Server-side: code (Cont.) $body = " "; $body = $body. " $firstName $lastName, thank you for registering for "; $body = $body. " the following workshop. "; $body = $body. " $workshops[$session] "; $body = $body. " You have selected a $lunch[$lunchChoice] for lunch. "; $body = $body. " "; The body starts and ends with HTML tags and encloses the ’s text. Recall that the period. corresponds to concatenation, so $body = $body. “something” adds something to whatever value the variable $body already has.

Server-side: code (Cont.) mail($ ,$subject,$body,$extra); The mail function above has four arguments: –The first is the address to which the will be sent. –The second is the subject field of the –The third is the actually content of the message (here it was put in HTML format) –The fourth includes a return address as well as an indication that we are using HTML formatting

Result (this part is the same as before)

Resulting