Web Technology HTML and PHP.

Slides:



Advertisements
Similar presentations
23-Aug-14 HTML/XHTML Forms. 2 What are forms? is just another kind of XHTML/HTML tag Forms are used to create (rather primitive) GUIs on Web pages Usually.
Advertisements

24-Aug-14 HTML Forms. 2 What are forms? is just another kind of HTML tag HTML forms are used to create (rather primitive) GUIs on Web pages Usually the.
1 Introduction to HTML II อุทัย เซี่ยงเจ็น สำนักวิชาเทคโนโลยีสารสนเทศ และการสื่อสาร มหาวิทยาลัยนเรศวร พะเยา.
1 Chapter 5 – Handling HTML Controls in Web Pages spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
Video, audio, embed, iframe, HTML Form
HTML Form and PHP IST Review of Previous Class HTML table and PHP array Winner is chosen automatically using rand() function.
Technologies for web publishing Ing. Václav Freylich Lecture 4.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Faculty of Sciences and Social Sciences HOPE PHP – Working with Input Stewart Blakeway FML 213
Web Database Programming Input Validation. User Input on the Web Web browser built-in mechanisms –HTML Forms HTTP POST method –Hyperlinks HTTP GET method.
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.
PHP and SQL Server: Queries IST2101. Project Report 4 SQL Queries Due Sunday, 4/5 at 11:59pm Instructions on how to access team webspace and SQL database.
Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
PHP: Introduction By Trevor Adams.
IS1500: Introduction to Web Development
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.
COM336 – Web Database Development XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical.
Unit 7 – Working with Forms 1. Creating a form 2. Accessing the submitted data 3. Common operations on forms.
ITM © Port, Kazman1 ITM 352 HTML Forms, Basic Form Processing.
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.
PHP Forms and User Input The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.
Lecture 6 – Form processing (Part 1) SFDV3011 – Advanced Web Development 1.
Lecture 7 – Form processing (Part 2) SFDV3011 – Advanced Web Development 1.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Homework for October 2011 Nikolay Kostov Telerik Corporation
HTML - Forms By Joaquin Vila, Ph.D.. Form Tag The FORM tag specifies a fill-out form within an HTML document. More than one fill-out form can be in a.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Using Client-Side Scripts to Enhance Web Applications 1.
Website Development with PHP and MySQL Saving Data.
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.
Dreamweaver MX. 2 Overview of Templates n Forms enable you to collect data from ______. n A form contains ________ such as text fields, radio buttons,
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
 HTML is hypertext markup language. It is a way for people to display their information with more complex pictures and text displays. Before HTML, messages.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
HTML and FORMS.  A form is an area that can contain form elements.  Form elements are elements that allow the user to enter information (like text fields,
CSC 2720 Building Web Applications Server-side Scripting with PHP.
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,
HTML Form and PHP IST Review of Previous Class HTML table and PHP array Winner is chosen randomly using rand() function.
CHAPTER 7 Form & PHP. Introduction All of the following examples in this section will require two web pages. The first page retrieves information posted.
CSC317 – INTERNET PROGRAMMING CSC318 – DYNAMIC WEB APPLICATION DEVELOPMENT BY: MUHD EIZAN SHAFIQ BIN ABD AZIZ FACULTY of COMPUTER and MATHEMATICAL SCIENCES.
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.
Web Technology Introduction to PHP. PHP PHP stands for PHP Hypertext Preprocessor PHP is a Server-Side Web Scripting language, which executes on the web.
FORM VALUE PASSING. Include  Include files are files that are interpreted as part of a program at runtime. Include files usually contain program code.
1 CSC317/318 INTERNET PROGRAMING / DYNAMIC WEB APPLICATION DEVELOPMENT Siti Nurbaya Ismail Faculty of Computer & Mathematical Sciences, Universiti Teknologi.
1 Building FORMS In When a visitor enters information into a web form displayed in a web browser and clicks the submit button, the information is sent.
Session 8: Working with Form iNET Academy Open Source Web Development.
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
Introduction To HTML Form Inputs Written By George Gimian.
The Web Wizard’s Guide To JavaScript Chapter 3 Working with Forms.
HTML5 Forms Forms are used to capture user input …
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.
Basic ActionScript and PHP Cis 126. Getting Started set up a basic folder structure so we can keep our files organized. Mirror this structure on your.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
HTML FORM AND PHP IST 210: Organization of Data IST210 1.
Form Data (part 2) MIS 3502, Fall 2015 Brad N Greenwood, PhD Department of MIS Fox School of Business Temple University 11/10/2015 Slide 1.
HTML FORM. Form HTML Forms are used to select different kinds of user input. HTML forms are used to pass data to a server. A form can contain input elements.
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.
Informatics Computer School CS114 Web Publishing HTML Lesson 4.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
Validation and Building Small Apps
Introducing Forms.
Presentation transcript:

Web Technology HTML and PHP

Create Form in HTML Action: <form name=‘myform’ action=‘filename.php’ method=POST> …Form’s Objects….. ……………………….. </form> Action: Specify the target php file to process this form method: GET: send data by appending them to the URL POST: send data with the body of form Data not visible to user

Set Variable Name to Form’s Objects Text Select Radio Button (use same names for all in the group) Check Box (use array[] for all in the group) <input type=‘text’ name=‘txtName’ value=‘’> <select name=‘sltDept’ > <input type=‘radio’ name=‘rdGender’ value=‘M’>Male <input type=‘radio’ name=‘rdGender’ value=‘F’>Female <input type=‘checkbox’ name=‘chkHobby[]’ value=‘sport’>Sports <input type=‘checkbox’ name=‘chkHobby[]’ value=‘book’>Books <input type=‘checkbox’ name=‘chkHobby[]’ value=‘music’>Music

Example of a Form <form action="test.php" method="post"> <input type="text" name="txtName"> <input type="radio" name="rdDept" value="TE">TE <input type="radio" name="rdDept" value="TM">TM <input type="radio" name="rdDept" value="TCT">TCT <input type="radio" name="rdDept" value="TTC">TTC <select name="sltDegree"> <option value="">=== Highest Degree ===</option> <option value="B">Bachalor</option> <option value="M">Master</option> <option value="D">Doctoral</option> </select> <input type="checkbox" name="chkHobby[]" value="music">Music <input type="checkbox" name="chkHobby[]" value="sport">Sports <input type="checkbox" name="chkHobby[]" value="book">Books </form>

Example of the Form

Retrieving Values from the Form in PHP If the method is “GET” If the method is “POST” We can use $_REQUEST[‘varname’] to get value, regardless of the method used in the form Let’s try this “phpinfo();”; <? echo $_GET[‘varname’]; ?> <? echo $_POST[‘varname’]; ?>

Retrieving Values from the Form in PHP Retrieving Values from a Text, Radio Button, and select is easy. Just refer to the object’s name (variable name) we want to retrieve the value from <? echo $_POST[‘txtName’].”<BR>”; echo $_POST[‘rdDept’].”<BR>”; echo $_POST[‘sltDegree’].”<BR>”; ?>

Retrieving Values from the Form in PHP Retrieving values from checkbox is a bit tricky We never know how many items would be checked It is also possible that no items be selected at all <?php for($i=0; $i < sizeof($_POST['chkHobby']); $i++) echo $_POST['chkHobby'][$i]."<HR>"; ?> or $hobby = $_POST[‘chkHobby’]; for($i=0; $i < sizeof($hobby); $i++) echo $hobby[$i]."<HR>";

So! What else? Make sure we validate data before submitting Use javascript to check the validity of data before sending them to the target PHP This is to make data ready for processing in PHP How can we make the form look nicer? Use <table> or <style> to help display better output What happens if method is “GET”, instead? Try to play with $_REQUEST[‘xxx’], see what happens? What happens if we want to store these values in the database?