>> PHP: Form-Variables & Submission

Slides:



Advertisements
Similar presentations
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.
Advertisements

PHP Workshop ‹#› Forms (Getting data from users).
Lecture 14 HTML Forms CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
CIS101 Introduction to Computing Week 08. Agenda Your questions JavaScript text Resume project HTML Project Six This week online Next class.
Video, audio, embed, iframe, HTML Form
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Tutorial 6 Working with Web Forms
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.
Forms. Form An HTML form is a section of a document containing normal content, special elements called controls (checkboxes, radio buttons, buttons, etc.),
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Week 4  Using PHP with HTML forms  Form Validation  Create your own Contact form Please Visit:
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.
HTML Forms What is a form.
Brief Overview of Web Forms L. G. Piper Bunker Hill Community College 23 March 2011.
PHP Forms and User Input The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.
INTERNET APPLICATION DEVELOPMENT For More visit:
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
BBK P1 Module2010/11 : [‹#›] Forms (Getting data from users)
HTML Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
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.
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
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.
PHP Form Introduction Getting User Information Text Input.
TJ 3043 – Web Application Development HTML Form. 2.0 Forms A form is the usual way to communicate information from a Web browser to a server HTML has.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
1 Review of Form Elements. 2 The tag Used in between tags.  Form elements(text control, buttons, etc.. ) goes here. OR  Form elements(text control,
TJ 3043 – Web Application Development HTML Form. 2.0 Forms - A form is the usual way information is gotten from a browser to a server - HTML has tags.
>> PHP: Insert Query & Form Processing. Insert Query Step 1: Define Form Variables Step 2: Make DB Connection Step 3: Error Handling Step 4: Define the.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
+ 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.
Starting BBEdit or Notepad and Opening the HTML File Start BBEdit or Notepad Select Open from the File Menu Open survey1.htm from the Public Folder.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Netprog CGI and Forms1 CGI and Forms A detailed look at HTML forms.
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.
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.
Web Forms. Web Forms: A form allows our web visitors to submit information to us. Some examples uses for forms are to let the web user contact us, fill.
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.
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,
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Tutorial 6 Working with Web Forms
PHP (Session 2) INFO 257 Supplement.
Client-Side Internet and Web Programming
ITM 352 HTML Forms, Basic Form Processing
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
>> PHP: Arrays.
>> More on HTML Forms
FORMS Explained By: Sarbjit Kaur.
>> PHP: HTML Integration
>> PHP: Form Processing
PHP FORM HANDLING Post Method
Validation and Building Small Apps
HTML Forms and User Input
Creating Form Elements
Querying Client Information Forms and Passing Data,
FORM OBJECT When creating an interactive web site for the Internet it is necessary to capture user input and process this input. Based on the result of.
Forms, cont’d.
>> PHP: Update Query
Creating Forms on a Web Page
Introduction to HTML: Forms
PHP-II.
PHP Programming Using Cloud 9 IDE.
Web Forms.
Presentation transcript:

>> PHP: Form-Variables & Submission

Form Submission <form > </form> id=“ “ name=“ “ action=“ “ method=“ “ For form identification File/function to call Method to submit the form GET | POST <form name=“contact” action=“process.php” method=“GET”> 1. contact.html 2. return contact.html 3. Fill form 4. process.php (values) 6. HTML File 5. Run process.php

GET Method Sends the form information by including it on the URL process.php?name=……&email=……&content=…… When to use Short forms, with only 1 or 2 input fields Forms with select, radio, and checkbox fields

Google Maps Graduation Party maps.google.com/maps?saddr=……&daddr=……. You are invited!!!!!!!! Please Please come If unable to find, enter your address below and I will guide you Maps with directions Guide Me <form action="http://maps.google.com/maps" method="get" target="_blank"> If unable to find, enter your address below and I will guide you <input type="text" name="saddr" /> <input type="hidden" name="daddr" value=“King Faisal University" /> <input type="submit" value=“Guide Me" /> </form>

Google Maps

POST Method Sends the data to the server in two steps Browser contacts the server Send the information When to use Longer forms, more than 3 input fields Forms with large textarea fields Forms where security is more important

Some Guidelines Always assign a name attribute to your form fields Eg. <input type=“text” name=“username”/> Remember Associative Arrays name=“username” => What the user enters Key Value How will you access this information in PHP Create a variable Use the associative array technique Index is the key name What is the array-name? Based on the method used $uname = array-name ‘username’ $_GET | $_POST

All Pre-defined Form Variables $_GET variable can be used to collect form data sent with the GET method. $_POST variable can be used to collect form data sent with the POST method. $_REQUEST variable can be used to collect form data sent with both the GET and POST methods. $varName = $_GET[‘username’]; $varName = $_POST[‘username’]; $varName = $_REQUEST[‘username’];

Back to Mini Project Our Old Files Go Online index.php header.php footer.php contact.php stuff.php Go Online Download the add-item.php file Copy in the same folder (D:\xampp\htdocs\Buy4mMe\) Now open the project in Aptana/NetBeans

Processing File TRY NOW TRY NOW Will this work? Create a new file called add-process.php Open the file and accept the submitted values from the form (using the $_POST variable) Write Insert Query to add the item to the database TRY NOW Will this work? Open the add-item.php file Go down to the form tag Add the attributes method action TRY NOW