Form Handling IDIA 618 Fall 2014 Bridget M. Blodgett.

Slides:



Advertisements
Similar presentations
Tutorial 6 Creating a Web Form
Advertisements

PHP Workshop ‹#› Forms (Getting data from users).
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Creating Web Page Forms. Objectives Describe how Web forms can interact with a server-based program Insert a form into a Web page Create and format a.
Tutorial 6 Working with Web Forms
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
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.
Creating Web Page Forms
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Preventing SQL Injection ~example of SQL injection $user = $_POST[‘user’]; $pass = $_POST[‘pass’]; $query = DELETE FROM Users WHERE user = ‘$user’ AND.
Tutorial #9 – Creating Forms. Tutorial #8 Review – Tables Borders (table, gridlines), Border-collapse: collapse; empty-cells: show; and rowspan, colspan.
MS3304: Week 4 PHP & HTML Forms. Overview HTML Forms elements refresher Sending data to a script via an HTML form –The post vs. get methods –Name value.
PHP Security.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
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.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Lecture 6 – Form processing (Part 1) SFDV3011 – Advanced Web Development 1.
CSE 382/ETE 334 Internet and Web Technology Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
CSCI 6962: Server-side Design and Programming Secure Web Programming.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
1 XHTML Forms A form is the mechanism to –Collect information from a browser user –Transmit collected information from a browser to a server HTML/XHTML.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
Accessing MySQL with PHP IDIA 618 Fall 2014 Bridget M. Blodgett.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
BBK P1 Module2010/11 : [‹#›] Forms (Getting data from users)
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
HTML Forms.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
Week 9 - Form Basics Key Concepts 1. 1.Describe common uses of forms on web pages 2.Create forms on web pages using the form, input, textarea, and select.
ITCS373: Internet Technology Lecture 5: More HTML.
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
1 HTML Forms
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
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.
Session 8: Working with Form iNET Academy Open Source Web Development.
HTML Forms a form is a container for input elements on a web page input elements contain data that is sent to the web server for processing.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
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.
Intro to Forms  HTML forms are used to gather information from end-users.  A form can contain elements like radio- buttons, text fields, checkboxes,
Web Page Design Forms! Website Design. Objectives What forms can do The Attributes of the form tag Using Textboxes Textareas Checkboxes Radio buttons.
+ FORMS HTML forms are used to pass data to a server. begins and ends a form Forms are made up of input elements Every input element has a name and value.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
Creating Web Page Forms COE 201- Computer Proficiency.
HTML Creating Forms on a Web Page. 2 Objectives  Discuss the process of creating a form  Distinguish between data input controls and text input controls.
Basic Webpage Design HTML Forms. Objectives Learn how to use HTML to create a form. Explain the concept of forms Know the difference of GET and POST Discuss.
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.
ASSIGNMENT 02 – Week of Nov 16 th IDEAS SQL insert and update statements Programmers-defined functions in PHP PHP safe IO functions: mysql_real_escape_string.
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.
1 HTML Forms
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
Lesson 5 Introduction to HTML Forms. Lesson 5 Forms A form is an area that can contain form elements. Form elements are elements that allow the user to.
Day 22, Slide 1 CSE 103 Day 22 Non-students: Please logout by 10:12. Students:
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
How to Write Web Forms By Mimi Opkins.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Validation and Building Small Apps
Introducing Forms.
HTML Forms and User Input
Forms, cont’d.
Presentation transcript:

Form Handling IDIA 618 Fall 2014 Bridget M. Blodgett

HTML Forms Forms are the primary method of gathering and transferring data using HTML You can have the form written in HTML (dropping out of PHP to do so) Or using the <<<_END and _END; commands you can embed it within the PHP

PHP Elements There are a couple of PHP elements specifically meant to deal with forms – $_GET and $_POST we have dealt with already – isset checks to see if the variable has been assigned a value (good for keeping undefined variable errors from appearing)

Hidden Fields Hidden fields are part of the HTML form which pass information to the browser but which aren’t directly viewable by the user Very useful for passing information like session ids, building information entered repeatedly into forms, etc – It’s important to remember that anything in this field is viewable within the HTML source

Input Name/ID Input Type Input Description text A simple text field to input an address of width and size 35. pwpasswordA password field of width and size 35. levelselect Make a select box with five options: Freshman, Sophomore, Junior, Senior, and Graduate. You can set the values for each of the options any way you want to. I used 1, 2, 3, 4, and 5. concentrationradio I made three radio buttons all with the name "concentration" so as to group them. I gave them text labels of "Computer Science" (value="CS"), "Information Science" (value="IS"), and "Information Technology" (value="IT"). Five checkboxes with the names “idia617", “idia618", “idia619" CheckboxI set them so that their value was "true". commentsTextarea I made a textarea with cols=40 and rows=5 with the default text, "Enter any comments you have here." sub_btnsubmitJust a submit button with the value "Submit Data."

Activity Apply the information on the next slide to a simple PHP form It should: – Read the input – Display the submitted options – Contain a SQL query to “send” the options to the database (you don’t actually have to connect to a db)

Sanitizing Input it is a trivial matter for a hacker to use their browser’s View Source feature to extract the form and modify it to provide malicious input – never trust any variable from either the $_GET or $_POST until you have processed it Always make sure to clean up any user input to prevent SQL injection errors – There are many types of escape characters that can execute

PHP Options PHP has a number of options to clean up user input: – mysql_real_escape_string() – stripslashes() – htmlentites() If you don’t want/need any HTML entities being passed: – strip_tags()

Placeholders One way to make a secure code without using the real escape string Predefine a query using ? characters then pass the user generated data to it – This avoids generating queries and directly inserts the information into the database How can we alter the book example from earlier to make use of this?

register_globals A deprecated feature of PHP that would automatically assign the input from a get or post to variables matching the same field name Potential security risk since malicious code can be passed as a get Always make sure to initialize your variables during their declaration