Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
HTML – A Brief introduction Title of page This is my first homepage. This text is bold  The first tag in your HTML document is. This tag tells your browser.
1 Introduction to HTML II อุทัย เซี่ยงเจ็น สำนักวิชาเทคโนโลยีสารสนเทศ และการสื่อสาร มหาวิทยาลัยนเรศวร พะเยา.
Images, Tables, lists, blocks, layout, forms, iframes
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
Computing Concepts Advanced HTML: Tables and Forms.
Intermediate PHP & MySQL
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.
HTML F ORMS. F ORMS HTML forms are used to pass data to a server. An HTML form can contain input elements like text fields, checkboxes, radio-buttons,
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
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 Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Web forms in PHP Forms Recap  Way of allowing user interaction  Allows users to input data that can then be processed by a program / stored in a back-end.
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.
4-Sep-15 HTML Forms Mrs. Goins Web Design Class. Parts of a Web Form A Form is an area that can contain Form Control/Elements. Each piece of information.
HTML Forms What is a form.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
INTERNET APPLICATION DEVELOPMENT For More visit:
DAT602 Database Application Development Lecture 14 HTML.
MySQL in PHP – Page 1 of 17CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: MySQL in PHP Reading: Williams &
INTERNET APPLICATION DEVELOPMENT For More visit:
Create an online booking system (login/registration)
Server-side Scripting Powering the webs favourite services.
HTML II. Factors to consider in designing a website. Organizing your files. HTML Tables. Unordered Lists. Ordered Lists. HTML Forms. Learning Objectives.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Python CGI programming
PHP meets MySQL.
Introduction to HTML. What is a HTML File?  HTML stands for Hyper Text Markup Language  An HTML file is a text file containing small markup tags  The.
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
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.
HTML : Forms, Frames Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
HTML, PHP, and MySQL: Putting It All Together. Making a Form Input tags Types: “text” “radio” “checkboxes” “submit”
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,
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.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
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.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
WEEK -1 ACM 262 ACM 262 Course Notes. HTML What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML.
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.
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
HTML for web designing short course. What is an HTML File? HTML stands for Hyper Text Markup Language An HTML file must have an htm or html file extension.
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,
HTML Tables Tables are defined with the tag. A table is divided into rows (with the tag), and each row is divided into data cells (with the tag). td stands.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
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.
Introduction to HTML.
How to Write Web Forms By Mimi Opkins.
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Presentation transcript:

Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries and extraction of results. Description and exemplification of forms processing to insert and amend data. Description of structure of HTML forms including: – the element and its action and method attributes – the element and its type, name and value attributes

Application Development - Description and exemplification of server-side scripting language for server connection Server-side scripting is a web server technology in which a user's request is fulfilled by running a script directly on the web server to generate dynamic HTML pages. It is usually used to provide interactive web sites that interface to databases or other data stores. This is different from client-side scripting where scripts are run by the viewing web browser. The primary advantage to server-side scripting is the ability to highly customize the response based on the user's requirements, access rights, or queries into data stores.

Application Development - Description and exemplification of server-side scripting language for server connection You have to connect to the database server and select the database to be used before you can execute MySQL statements. PHP has a number of commands which are used for this purpose. The following PHP function call establishes the connection: – mysql_connect(address, username, password); The mysql_connect function shown above, for example, returns a number that identifies the connection that has been established. We need to store this value so that we can make use of it later to select the database we wish to use. – $varconnect = mysql_connect("localhost", "root", "password"); What's important to see here is that the value returned by mysql_connect (which we'll call a connection identifier) is stored in a variable named $varconnect.

Application Development- Description and exemplification of server-side scripting language for database selection Selecting that database in PHP uses another function call: – mysql_select_db(database_name, database_connection); For example: – mysql_select_db("freedomofmidnight", $varDBconnect); The $varDBconnect variable that contains the database connection identifier is used to tell the function which database connection to use. This parameter is actually optional. When it's omitted, the function will automatically use the details of the last connection opened. This function returns true when it's successful and false if an error occurs.

Application Development- Description and exemplification of server- side scripting language execution of SQL queries and extraction of results All SQL queries are executed using the mysql_query() function. This executes the query and returns the results set as an array of values. – $result_array=mysql_query($query_string); This can be used with symbol, as before, to suppress error messages This allows you to use the mysql_error function to access the last error set by the MySQL server. MySQL also keeps track of the number of rows affected by INSERT, DELETE and UPDATE queries and the number of rows in the results of a SELECT query. This number can be accessed using the mysql_affected_rows() function.

Application Development- Description and exemplification of server- side scripting language execution of SQL queries and extraction of results For most SQL queries, the mysql_query() function returns either true (success) or false (failure) but for SELECT queries the function returns the result set, the answer table, generated by the query. False is still returned if the query fails for any reason. – $result name FROM publisher"); if (!$result) { echo(" Error performing query: ". mysql_error(). " "); exit(); } As long as no error is encountered in processing the query, the above code places a result set that contains the names of all the publishers stored in the publisher table into the variable $result. There is no practical limit on the number of publishers in the database so the result set generated can be very large.

Application Development- Description and exemplification of forms processing to insert and amend data. For many applications of PHP, the ability to interact with users who view the Web page is essential. Server-side scripting languages such as PHP have a more limited scope when it comes to user interaction. As PHP code is activated when a page is requested from the server, user interaction can occur only in a back-and-forth fashion: the user sends requests to the server, and the server replies with dynamically generated pages. The key to creating interactivity with PHP is to understand the techniques used to send information about a user's interaction along with his or her request for a new Web page.

Application Development- Description and exemplification of forms processing to insert and amend data. The GET Method: – The simplest method that can be used to send information along with a page request uses the URL query string. If you've ever seen a URL with a question mark following the file name, you've seen this technique in use. Hi, I'm Charlie! – The above code is a link created in an HTML document, – This is a link to a file called welcome1.php, but as well as linking to the file, we're also passing a variable along with the page request. The variable is passed as part of the query string, which is the portion of the URL that follows the question mark. The variable is called name and its value is Charlie. To restate, we have created a link that loads welcome1.php, and informs the PHP code contained in the file that name equals Charlie.

Application Development- Description and exemplification of forms processing to insert and amend data. The GET Method: – To really understand the results of this process, we need to look at welcome1.php – Now, if you use the link in the first file to load this second file, you'll see that the page says "Welcome to our Website, Charlie!" – PHP automatically creates an array variable called $_GET that contains any values passed in the query string. $_GET is an associative array, so the value of the name variable passed in the query string can be accessed as $_GET['name']. Our script assigns this value to an ordinary PHP variable ($name) and then displays it as part of a text string using the echo function.

Application Development- Description and exemplification of forms processing to insert and amend data. The POST Method: – It's not always desirable - or even technically feasible - to have the values appear in the query string. What if we included a tag in the form, to let the user enter a large amount of text? A URL that contained several paragraphs of text in the query string would be ridiculously long, and would exceed by far the maximum length of the URL accepted by browsers. – The alternative is for the browser to pass the information invisibly, behind the scenes. The code for this looks exactly the same, but we use the POST method instead of the GET method used in the last example.

Application Development- Description and exemplification of forms processing to insert and amend data. The POST Method: This HTML code would be entered in the link Untitled Document First Name: Last Name:

Application Development- Description and exemplification of forms processing to insert and amend data. The POST Method: As we're no longer sending the variables as part of the query string, they no longer appear in PHP's $_GET array. Instead, they are placed in another array reserved especially for 'posted' form variables: $_POST. The php would be as follows: Untitled Document <?php $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; echo( "Welcome to my Website, $firstname $lastname!" ); ?>

Application Development- Description and exemplification of forms processing to insert and amend data. The IF control structure allows decisions to be made: The php would be as follows: Untitled Document <?php $firstname = $_GET['firstname']; $lastname = $_GET['lastname']; if ( $firstname == 'Charlie' and $lastname == 'Burton' ) { echo( 'Hi, How can I help you, Charlie' ); } else { echo( "Welcome to my Website, $firstname $lastname!" ); } ?>

Application Development- Description and exemplification of forms processing to insert and amend data. The while loop uses a condition to determine how many times a piece of code is executed (conditional loop): The php would be as follows: Untitled Document <?php $count = 1; while ($count <= 10) { echo( "$count " ); $count++; } ?>

Application Development- Description and exemplification of forms processing to insert and amend data. The For loop is used when a set number of repetitions are required. Often this is when a value is being counted. (Fixed Loop) The php would be as follows: Untitled Document <?php for ($count = 1; $count <= 10; $count++) { echo( "$count " ); ?>

Application Development - Description of structure of HTML forms HTML documents are text files made up of HTML elements. HTML elements are defined using HTML tags. HTML Tags – HTML tags are used to mark-up HTML elements – HTML tags are surrounded by the two characters – The surrounding characters are called angle brackets – HTML tags normally come in pairs like and – The first tag in a pair is the start tag, the second tag is the end tag – The text between the start and end tags is the element content – HTML tags are not case sensitive, means the same as

Application Development - Description of structure of HTML forms Basic HTML Tags Defines an HTML document Defines the document's body to Defines header 1 to header 6 Defines a paragraph Inserts a single line break Defines a horizontal rule Defines a comment

Application Development - Description of structure of HTML forms Tables are defined with the tag. A table is divided into rows (with the tag), and each row is divided into data cells (with the tag). The letters td stands for "table data," which is the content of a data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal rules, tables, etc. row 1, cell 1 row 1, cell 2 row 2, cell 1 row 2, cell 2

Application Development - Description of structure of HTML forms Basic Table HTML Tags Defines a table Defines a table header Defines a table row Defines a table cell Defines a table caption Defines groups of table columns Defines the attribute values for one or more columns in a table Defines a table head Defines a table body Defines a table footer

Application Development - Description of structure of HTML forms HTML tag The option element defines an option in the drop-down list. Example Volvo Saab Opel Audi

Application Development - Description of structure of HTML forms HTML Elements Here is an example: Title of page This is my first homepage. This text is bold This is an HTML element: – This text is bold The HTML element starts with a start tag: The content of the HTML element is: This text is bold The HTML element ends with an end tag: The purpose of the tag is to define an HTML element that should be displayed as bold.

Application Development - Description of structure of HTML forms 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, textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in a form. A form is defined with the tag. eg –

Application Development - Description of structure of HTML forms Input – The most used form tag is the tag. The type of input is specified with the type attribute. The most commonly used input types are explained below. – Text Fields Text fields are used when you want the user to type letters, numbers, etc. in a form. First name: Last name:

Application Development - Description of structure of HTML forms Input – The most used form tag is the tag. The type of input is specified with the type attribute. The most commonly used input types are explained below. – Password Fields Password fields are used when you want the users entry to be hidden with *. User ID: Password:

Application Development - Description of structure of HTML forms Radio Buttons Radio Buttons are used when you want the user to select one of a limited number of choices. Male Female Note that only one option can be chosen.

Application Development - Description of structure of HTML forms Checkboxes – Checkboxes are used when you want the user to select one or more options of a limited number of choices. I have a bike: I have a car: I have an airplane:

Application Development - Description of structure of HTML forms The Form's Action Attribute and the Submit Button – When the user clicks on the "Submit" button, the content of the form is sent to another file. The form's action attribute defines the name of the file to send the content to. The file defined in the action attribute usually does something with the received input. Username: – Username: If you type some characters in the text field above, and click the "Submit" button, you will send your input to a page called "html_form_action.asp". That page will show you the received input.