0% found this document useful (0 votes)
11 views16 pages

1.3.1 Form Handling

The document outlines a course on Web Technologies for a Bachelor of Computer Application program, focusing on PHP basics, WordPress themes, and database connectivity. It covers form handling using GET and POST methods, including their differences and security aspects. Additionally, it provides examples, controls used in forms, and references for further learning.

Uploaded by

siyalohiya67
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views16 pages

1.3.1 Form Handling

The document outlines a course on Web Technologies for a Bachelor of Computer Application program, focusing on PHP basics, WordPress themes, and database connectivity. It covers form handling using GET and POST methods, including their differences and security aspects. Additionally, it provides examples, controls used in forms, and references for further learning.

Uploaded by

siyalohiya67
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

UNIVERSITY INSTITUTE OF COMPUTING

Bachelor of Computer Application


Subject Name: Web Technologies
22CAH-371/23SCH-254

Web Technologies DISCOVER . LEARN . EMPOWER


1
Web Technologies
• Web development
Course Outcome
CO Title Level
• History
Number • Static pages
CO1 Understand • Dynamic pages
Students will learn basics of PHP

CO2 Understand &


Students will understand the underlying concept of themes in Analyze
wordpress.

CO3 Understand
Students will learn database connectivity, plugin and security
issues.

2
Web Development
Using PHP
Course Outcome • OOP
CO Title Level
Number
• Session and Cookies
Understand
• File handling
CO1
Students will learn basics of PHP • Database
CO2 Understand &
Students will understand the underlying concept of themes in Analyze
wordpress.

CO3 Understand
Students will learn database connectivity, plugin and security
issues.

3
Topics to be Covered
• Form Handling
• GET
• POST
• REQUEST

4
PHP Form Handling
• We can create and use forms in PHP. To get form data, we need to use
PHP superglobals $_GET and $_POST.
• The form request may be get or post. To retrieve data from get
request, we need to use $_GET, for post request $_POST.
PHP Get Form
Get request is the default form request. The data passed through get
request is visible on the URL browser so it is not secured. You can send
limited amount of data through get request.

5
Steps for Handling Forms

•Create an HTML Form: The form collects user input.


•Submit the Form: The form data is sent to a PHP script using
either the GET or POST method.
•Process the Form Data: The PHP script processes the submitted
data.

6
Attribu Attribute Description

tes of
It specifies the name of the form and is used to identify individual
name or id forms.

It specifies the location to which the form data has to be sent

Form
action when the form is submitted.

It specifies the HTTP method that is to be used when the form is

Tag:
submitted. The possible values are get and post. If get method is
method used, the form data are visible to the users in the url. Default HTTP
method is get.

It specifies the encryption type for the form data when the form is
encType submitted.

novalidate It implies the server not to verify the form data when the form is
submitted.

7
Controls used in forms:
• Form processing contains a set of controls through which the client and server
can communicate and share information
• Textbox: Textbox allows the user to provide single-line input, which can be
used for getting values such as names, search menu and etc.
• Textarea: Textarea allows the user to provide multi-line input, which can be
used for getting values such as an address, message etc.
• DropDown: Dropdown or combobox allows the user to provide select a value
from a list of values.
• Radio Buttons: Radio buttons allow the user to select only one option from
the given set of options.
• CheckBox: Checkbox allows the user to select multiple options from the set
of given options.
• Buttons: Buttons are the clickable controls that can be used to submit the
form.
8
Let's see a simple example to receive data from get
request in PHP.
File: form1.html
<form action="welcome.php" method="get">
Name: <input type="text" name="name"/>
<input type="submit" value="visit"/>
</form>

File: welcome.php
<?php
$name=$_GET["name"];//receiving name field value in $name variable
echo "Welcome, $name";
?>

9
PHP Post Form
Post request is widely used to submit form that have large
amount of data such as file upload, image upload, login form,
registration form etc.
The data passed through post request is not visible on the URL
browser so it is secured. You can send large amount of data
through post request.
Let's see a simple example to receive data from post request in
PHP.
<form action="login.php" method="post">
<table>
<tr><td>Name:</td><td> <input type="text"
name="name"/></td></tr>
<tr><td>Password:</td><td> <input type="password"
name="password"/></td></tr>
<tr><td colspan="2"><input type="submit" value="login"/>
10
</td></tr>
GET vs. POST

• Both GET and POST create an array (e.g. array( key1 => value1, key2 => value2,
key3 => value3, ...)). This array holds key/value pairs, where keys are the names
of the form controls and values are the input data from the user.
• Both GET and POST are treated as $_GET and $_POST. These are superglobals,
which means that they are always accessible, regardless of scope - and you can
access them from any function, class or file without having to do anything special.
• $_GET is an array of variables passed to the current script via the URL parameters.
• $_POST is an array of variables passed to the current script via the HTTP POST
method.

11
PHP - $_REQUEST

$_REQUEST
$_REQUEST is a PHP super global variable which contains submitted form data, and all cookie data.
In other words, $_REQUEST is an array containing data from $_GET, $_POST, and $_COOKIE.

$_REQUEST['firstname']

12
Image References

[1] www.w3resource.com/w3r_images/class-and-object-of-class.gif

[3]www.expertphp.in/images/articles/

ArtImgC67UTd_classes_and_objects.jpg

13
Book References
• Php: The Complete Reference, Steven Holzner, Tata McGraw-
Hill Education, 2007
• Modern PHP: New Features and Good Practices, Josh Lockhart,
"O'Reilly Media, Inc.“, 2015.
• PHP for the Web: Visual QuickStart Guide, Larry Ullman
Pearson Education, 2006.
• https://www.tutorialspoint.com/php/index.htm
• https://www.codecademy.com/learn/learn-php

14
Video Links
• https://www.youtube.com/watch?v=3RlDZEa6gW8
• https://www.youtube.com/watch?v=xqI2hdDn47k

15
THANK YOU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy