312
Insert New Data into a Table with PHP .....................
3 Type
”?”>, replacing? with the
ID you plan to use for your
first field.
4 Type a label for the field.
5 Type .
Create the Form
1 In your editor, open a new
HTML document.
2 Within the body, type
<form method=”post”
action=”?”>, replacing?
with the filename you plan
to use for your PHP script.
Insert New Data into a Table with PHP
P
HP pages can perform any database operations. Although the most common uses are querying the
database and displaying the resulting fields, you can also use PHP to add records to your table.
Administrators need to do this to populate the table with data, but you may have situations where
users will need to do so as well, such as self-registration systems. In order to insert new data, you
begin by creating a HTML form. The form must contain one form control for each database field into
which you want to insert data.