HTML Forms & PHP. Database Systems CSCI Dr. Tom Hicks Computer Science Department

Similar documents
HTML Forms & PHP & MySQL Database. Database Systems CSCI-3343 Dr. Tom Hicks Computer Science Department

PHP & MySQL Database. Database Systems CSCI Dr. Tom Hicks Computer Science Department

1. Begin by selecting [Content] > [Add Content] > [Webform] in the administrative toolbar. A new Webform page should appear.

PHPRad. PHPRad At a Glance. This tutorial will show you basic functionalities in PHPRad and

Development Technologies. Agenda: phpmyadmin 2/20/2016. phpmyadmin MySQLi. Before you can put your data into a table, that table should exist.

HTML Forms. By Jaroslav Mohapl

Database Connectivity using PHP Some Points to Remember:

Web Application Development (WAD) V th Sem BBAITM (Unit 4) By: Binit Patel

COMS 359: Interactive Media

Web Site Design and Development Lecture 23. CS 0134 Fall 2018 Tues and Thurs 1:00 2:15PM

Faculty Web Page Management System. Help Getting Started

CGI Programming. What is "CGI"?

User Manual Appointment System

Perch Documentation. U of M - Department of Computer Science. Written as a COMP 3040 Assignment by Cameron McKay, Marko Kalic, Riley Draward

The connection has timed out

Web Focused Programming With PHP

Web Programming. Based on Notes by D. Hollinger Also Java Network Programming and Distributed Computing, Chs.. 9,10 Also Online Java Tutorial, Sun.

Testing Documentation

JavaScript Functions, Objects and Array

Webshop Plus! v Pablo Software Solutions DB Technosystems

B. V. Patel Institute of BMC & IT 2014

Survey Creation Workflow These are the high level steps that are followed to successfully create and deploy a new survey:

Locate your Advanced Tools and Applications

Creating Forms in SOCS

Checklist for Testing of Web Application

The Electronic Voting System - EVS

Networks and Web for Health Informatics (HINF 6220) Tutorial 13 : PHP 29 Oct 2015

ITEC447 Web Projects CHAPTER 9 FORMS 1

Connecting VirtueMart To PayPal (Live)

FreeRangeRemote Access

Outline. Introducing Form. Introducing Forms 2/21/2013 INTRODUCTION TO WEB DEVELOPMENT AND HTML

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. WordPress

Affinity Provider Portal Training Manual

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

Web Design and Development ACS Chapter 13. Using Forms 11/27/2018 1

Intro To HTML & Web & Relational Queries Individual Assignment 30 Points

Building Web Based Application using HTML

DR B.R.AMBEDKAR UNIVERSITY B.Sc.(Computer Science): III Year THEORY PAPER IV (Elective 4) PHP, MySQL and Apache

USING PERFORMANCE PRO A Multi-Appraiser s Quickstart Guide. HRperformancesolutions.net 4/2017 v. 3.9

HTML Tables and Forms. Outline. Review. Review. Example Demo/ Walkthrough. CS 418/518 Web Programming Spring Tables to Display Data"

ecommerce Features Ability to control the width and height of suggested items on viewitem page. Can now limit the field length on a PDF template.

Chapter 3 HTML Multimedia and Inputs

An Online Interactive Database Platform For Career Searching

ABSOLUTE FORM PROCESSOR ADMINISTRATION OPTIONS

Learn how to login to Sitefinity and what possible errors you can get if you do not have proper permissions.

Dreamweaver: Web Forms

GoLive will first ask you if your new site will be for one individual or a work group; select for a Single User, and click Next.

Last &me: Javascript (forms and func&ons)

SelectSurveyASP Advanced User Manual

Chapter. Accessing MySQL Databases Using PHP

MyHVP Web Application User Guide

Help Contents. Creating a Query - Synopsis

CSS Review. Objec(ves. Iden(fy the Errors. Fixed CSS. CSS Organiza(on

CSCI 4000 Assignment 4

Web publishing training pack Level 3 Forms

ICSE REGISTRATION MODULE V 2.0. User Guide for Schools

Step 1. Final Grade Roster Submission. IT Department Printed on 05/21/2012 Page 1. Steps to Submit Grades. Step 1. Step 2. Step 3

CSE 154 LECTURE 8: FORMS

Chapter 1 FORMS. SYS-ED/ Computer Education Techniques, Inc.

The Crypt Keeper Cemetery Software Online Version Tutorials To print this information, right-click on the contents and choose the 'Print' option.

A QUICK GUIDE TO PROGRAMMING FOR THE WEB. ssh (then type your UBIT password when prompted)

DRACULA. CSM Turner Connor Taylor, Trevor Worth June 18th, 2015

Login: Quick Guide for Qualtrics May 2018 Training:

Jackson State University Department of Computer Science CSC / Advanced Information Security Spring 2013 Lab Project # 3

Lasell College s Moodle 3 Student User Guide. Access to Moodle

UNIVERSITY OF CALGARY Information Technologies WEBFORMS DRUPAL 7 WEB CONTENT MANAGEMENT

Publish Joomla! Article

Form Overview. Form Processing. The Form Element. CMPT 165: Form Basics

Publish Joomla! Article

Categories In WordPress

Step 1 - Go to Step 2 - Login to your account. Step 3 - Click Register for a Test. Step 4 - Read the Requirements

International SOS e-learning Training Hub User Guide

AETNA PRODUCER CERTIFICATION PORTAL

Blue Form Builder extension for Magento 2

Design and development of GUI for Mobile App with MS Phone SDK. Bridging Windows Mobile GUI with php mysql. Lab Manual (for Windows 7 OS)

Table of Contents III. Publish to Living Spaces

LimeSurvey User Guide to Creating Surveys

SchoolDesk University

Web development using PHP & MySQL with HTML5, CSS, JavaScript

Quick Start Guide. Table of Contents

Instructional Technology & Technology Enhancement Center -itec Grade Center Tutorial for Faculty

Faculty User Guide: Assessing Submissions. Faculty User Guide: Assessing Submissions

The address is:

How to Register and Manage Buyer Accounts for a Customer Organization on Version 5 April 2007

Using PHP with MYSQL

User Guide. Form Builder. Extension Version User Guide Version Magento Editions Compatibility. Community - 2.2

Building a Web-based Health Promotion Database

Protect My Ministry Integrated Background Checks for Church Community Builder

All Applications Release Bulletin January 2010

Admin Guide Hosted Applications

Book IX. Developing Applications Rapidly

File Cabinet Manager

Hello, and welcome to the Alexicomtech tutorial. I will show you step by step how to set up your interactive pages. Please feel free to ask questions

icc.edu/library Films on Demand Guide for Faculty and Staff

Table of contents. Zip Processor 3.0 DMXzone.com

!Accessibility Issues Found

Joomla Pre-install Tasks

Row and Column Spans. Homework. Column and Row Span Example (2) Column and Row Span Example. tables: Live Demo. like the following using forms:

ABOUT WEB TECHNOLOGY COURSE SCOPE:

Requirements Document

Transcription:

HTML Forms & PHP Database Systems CSCI-3343 Dr. Tom Hicks Computer Science Department

Create Page Faculty-Add.php

AddFaculty Page Create page Faculty-Add.php It will be blank for the moment. We are going to use this page as our data collection page. <HTML> <HEAD><TITLE>Faculty Add </TITLE></HEAD> <BODY BGCOLOR = Navy LINK = Yellow VLINK ="#FFFF00" ALINK = Yellow TEXT = White> <CENTER><H1> ADD FACULTY </H1> <H3> Written By Dr. Tom Hicks </H3></CENTER> </BODY></HTML>

AddFaculty Page

FORM Element

FORM HTML forms are used to pass data to a server. An HTML form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select lists, textarea, fieldset, legend, and label elements. The form element begins with <FORM> and ends with </FORM> Add the form to the body of the Faculty-Add.php <FORM> </FORM>.

GUI s Helpful

GUI s Helpful

GUI s Helpful

FORM METHOD = GET METHOD = GET Cacheable Does not automatically re-request info Should be used only if form is Indepotent Browser will reprocess with no warning Would Re-Bill a credit card with no browser warning May require POST for Indepotent if URL is long For getting/retrieving data only! <FORM METHOD = "GET" > </FORM>.

FORM METHOD = POST METHOD = POST Browser will generally reprocess with a warning Don t want credit card rebilled twice I always use with database queries I always want the most recent data Many folks simply use POST all of the time <FORM METHOD = "POST" > </FORM>.

FORM METHOD = GET METHOD = GET Get can also expose more of the sensitive information because it is appended to the URL. (See Below!) Security Risk! <FORM METHOD = GET" > I USE POST! </FORM>.

FORM ACTION = AddFaculty-Confirmation.php ACTION = Form Process Page URL Relative or Absolute Suppose the data collection page Faculty-Add.php The contents of the form will often be sent to another page for processing; i.e. adding this faculty member record to the database. The data collection page & the process page can be one and the same, but this is often a bit more complex and limiting. I would call the page to add the confirmation page AddFaculty-Confirmation.php It is not the purpose of this presentation to add the record to the database; we are only examining the HTML transfer of information. <FORM METHOD = "POST" ACTION = "AddFaculty-Confirmation.php"> </FORM>.

Create Page AddFaculty-Confirmation.php

AddFaculty-Confirmation Page Create page AddFaculty-Confirmation.php It will be blank for the moment. We are going to use this page as our data collection page. <HTML> <HEAD><TITLE>Add Faculty Confirmation</TITLE></HEAD> <BODY BGCOLOR = "#800000" LINK = Yellow VLINK ="#FFFF00" ALINK = Yellow TEXT = White> <CENTER><H1> ADD FACULTY CONFIRMATION </H1> <H3> Written By Dr. Tom Hicks </H3></CENTER> </BODY></HTML>

AddFaculty-Confirmation Page

Form Submission

FORM ID = form1 NAME = form1 NAME = form1 ID = form1 HTML offers the ability to logically navigate to named regions on the page. You might choose to automatically move the cursor into one of the form textboxes when a form is loaded you will need the NAME. <FORM METHOD = "POST" ACTION = "Login-Confirmation.php " ID = "form1" NAME = "form1"> </FORM>.

INPUT TYPE = SUBMIT NAME = form1 ID = form1 HTML offers the ability to logically navigate to named regions on the page. You might choose to automatically move the cursor into one of the form textboxes when a form is loaded you will need the NAME. <FORM METHOD = "POST" ACTION = "Login-Confirmation.php " ID = "form1" NAME = "form1"> <INPUT TYPE ="submit" VALUE ="Add Faculty Member Now!"> </FORM>.

Push The Submit Button

Confirmation Page The confirmation page may be a relative address as seen above. The confirmation page may be absolute as shown to google below. <FORM METHOD="POST" ACTION="http://google.com"> <INPUT TYPE ="submit" VALUE = "Go To Google Now"> </form>

Text Input Element & PHP Form Processing

INPUT TYPE = Text The INPUT element is used for collecting data entered by keyboard. The data may be alpha The data may be numeric Add the code below to your form on Faculty-Add.php First <INPUT NAME = "First" TYPE = "text" SIZE = "15"><P>.

Recover Data Passed To Confirmation Page Data processed in the confirmation can be recovered from &_POST First < INPUT NAME = "First" TYPE = "text" SIZE = "15"><P> Add the following block of code to the confirmation page. <HR COLOR=PEARL SIZE=6 NOSHADE /> <?PHP $First = $_POST['First']; print "First = ". $First. "<BR>";?>

INPUT TYPE = Text The INPUT element is used for collecting data entered by keyboard. The data may be alpha The data may be numeric Add the code below to your form on Faculty-Add.php Age <INPUT NAME = "Age" TYPE = "text" SIZE = " 2"><P>.

Recover Data Passed To Confirmation Page Data processed in the confirmation can be recovered from &_POST First < INPUT NAME = "First" TYPE = "text" SIZE = "15"><P> Add the following block of code to the confirmation page. <HR COLOR=PEARL SIZE=6 NOSHADE /> <?PHP $Age = $_POST['Age']; print "Age = ". $Age. "<BR>";?>

Checkbox Input Element & PHP Form Processing

INPUT TYPE = Checkbox The checkbox can be a binary type selection Add the code below to your form on Faculty-Add.php Tenured <INPUT NAME ="Tenured" TYPE ="checkbox"><p>.

Recover Data Passed To Confirmation Page Data processed in the confirmation can be recovered from &_POST Tenured <INPUT NAME ="Tenured" TYPE ="checkbox"><p> Add the following block of code to the confirmation page. if(empty($_post['tenured'])) $Tenured = "false"; else $Tenured = "true"; print "Tenured = ". $Tenured. "<BR>";

INPUT TYPE = Checkbox There may be more than two responses associated with a checkbox input. Add the code below to your form on Faculty-Add.php Department <INPUT TYPE = "checkbox" NAME = "Department" VALUE = "Computer Science"> Computer Science <INPUT TYPE = "checkbox" NAME = "Department" VALUE = "Mathematics" > Mathematics <P>

Recover Data Passed To Confirmation Page Data processed in the confirmation can be recovered from &_POST Add the following block of code to the confirmation page. There may be a dozen, or more, choices if necessary. if(empty($_post['department'])) $Department = "None"; else $Department = $_POST['Department']; print "Department = ". $Department. "<BR>";

Checkbox Input Element & PHP Form Processing

INPUT TYPE = Radio The checkbox can be unary, binary, or more. Add the code below to your form on Faculty-Add.php Rank <INPUT TYPE = "radio" NAME = "Rank" VALUE = "Full Professor" > Full Professor <INPUT TYPE = "radio" NAME = "Rank" VALUE = "Associate Professor" > Associate Professor <INPUT TYPE = "radio" NAME = "Rank" VALUE = "Assistant Professor" > Assistant Professor <P>

Recover Data Passed To Confirmation Page Data processed in the confirmation can be recovered from &_POST Add the following block of code to the confirmation page. if(empty($_post['rank'])) $Rank = "None"; else $Rank = $_POST['Rank']; print "Rank = ". $Rank. "<BR>";

Select/Combobox Element & PHP Form Processing

SELECT Combobox The select combobox is a dropdown control that can be binary, or more. Add the code below to your form on Faculty-Add.php Gender <select name="gender"> <option value="">select Gender</option> <option value="male">male</option> <option value="female">female</option> </select> <P>

Recover Data Passed To Confirmation Page Data processed in the confirmation can be recovered from &_POST Add the following block of code to the confirmation page. $Gender = $_POST['Gender']; print "Gender = ". $Gender. "<BR>";

Hidden Element & PHP Form Processing

INPUT TYPE = Hidden Nothing appears on the page? Add the code below to your form on Faculty-Add.php <INPUT NAME = "Secret" TYPE = "hidden" VALUE="Computer Science Rocks">

Recover Data Passed To Confirmation Page Data processed in the confirmation can be recovered from &_POST Add the following block of code to the confirmation page. $Gender = $_POST['Secret']; print "Secret = ". $Secret. "<BR>";

Textarea (Multiline) Element & PHP Form Processing

SELECT Combobox The select combobox is a dropdown control that can be binary, or more. Add the code below to your form on Faculty-Add.php Comments <BR> <TEXTAREA NAME = "Comments" COLS = "70" ROWS = "7"> Enter your comments here... </TEXTAREA><P>

Data To Be Passed!

Recover Data Passed To Confirmation Page Data processed in the confirmation can be recovered from &_POST Add the following block of code to the confirmation page. $Comments = $_POST['Comments']; print "Comments = <BR>"; print $Comments. "<P>";

PHP Redirect

Logical Redirect Every Scripting Language needs some way to logically redirect files to another web page. Suppose we wished to load page localhost/php/displayusers.php if the faculty member is in the Mathematics department. Add the following code to AddFaculty-Confirmation.php in order to make that happen. if ($Department = "Mathematics") header("location: http://localhost/php/displayusers.php");

Redirect function I use this redirection on many pages I often abstract it to a function, called Redirect: Return to page Connection.php, used in other PHP Database tutorials. <?php /*============================================================= === Connect To MySQL Database === =============================================================*/ $server ="localhost"; $username="root"; $password="trinity"; $database="libraryth"; $conn = new mysqli(); $conn->connect($server, $username, $password, $database); function Redirect ($URL) { header("location: http://". $URL); }?>

Evoking Redirect function Connection.php, used in other PHP Database tutorials. function Redirect ($URL) { header("location: http://". $URL); } Add the following code to AddFaculty-Confirmation.php in order to make that happen. if ($Department = "Mathematics") Redirect("localhost/php/DisplayUsers.php");

Disclaimer

Recover Data Passed To Confirmation Page None of the forms in this tutorial illustrate how user-friendly forms should be generated. See the tutorial on good form design.

Database Systems CSCI 3343 Dr. Thomas E. Hicks Computer Science Department Trinity University 51