Practice Exercise: Form for Query
Create an HTML form and use PHP to specify a key for a database row to be
accessed, then produce a page to display the data.
1. Within the body of an HTML page, code a start tag for a form and include an
action attribute with a value that references a PHP script. What is indicated
by this component? How is it actuated?
2. Also, define a method attribute for this form tag with the value "post".
How will this value affect the code used in the PHP script?
3. Specify how and where to place an identifying label on a form.
4. Create a form for data collection with labeled text boxes. Include unpaired
input components(tags) for one or more data items each having an attribute
for the text(box) type and for a name specifying a parameter to pass. Include
another input component with a type attribute for a "submit" button and
a value attribute to cause the label to be "enter". The form's action
attribute should reference a php program named PrintFormData. Specify the
"post" method.
5. Code a PHP script to access the $_POST array for the value associated with
the form variable(s). Use their names as "associative indexes" and assign
their values to local variables. Use SQL to retrieve then print(echo) the
database data.