Lecture 10 PHP Form Handling
Lecture 10 PHP Form Handling
Somaville University
Eng.Islow
22.5.2025
Introduction
2
Form Handling: What Is It?
4
Syntax:
<form [attributes]>
Form controls
</form>
5
Attributes of the HTML form
element
Among the many attributes of the HTML form element, the
following are often necessary and specified:
1) Action:
A string represents the URL that handles the form submission. Take
http://example.com/test.php, for instance. Use the PHP_SELF server
variable - to provide the for-data to the same PHP script that defines
the HTML form
<form action="<?
php echo htmlentities($_SERVER['PHP_SELF']); ?
>" method="post">
6
2- Enctype:
8
4-Name:
9
5-Target:
After the form is submitted, the Target Attribute is a string that specifies where the
answer should be shown. One of the following should be the case:
a) _self (by default) - The current browsing context will be used when you load.
b) _blank - Enter a fresh, anonymous browsing environment.
c) _parent - Enter the current browsing context's parent.
d) _top - The top-level browsing context, which is an ancestor of the present one and
lacks a parent, is loaded by the command _top.
e) Thus, a standard HTML form in a PHP web application appears as follows:
<form name="form1" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?
>" method="POST">
<!-- Form controls go here -->
</form>
10
Form Elements
A variety of controls and components are
used in the design of an HTML form. These
controls allow the user to input data or
choose from the choices that are shown.
A few of the elements are explained here.
11
1- Input:
13
2)Radio:
14
Example:
Lecture 2 16
File:
Lecture 2 17
6-Select
</select>
18
Questions
19