There’s nothing significantly new here. The document still uses the same basic syntax for an HTML page as in the previous chapter. An HTML comment indicates the file’s name and number. 2. Add the initial form tag. php extension (since a PHP page will handle this form’s data). 3. Begin the HTML form. DOCTYPE html PUBLIC “-//W3C// 6 12 1. 1). dtd”> 4 10 To create an HTML form: Chapter 2 I’m using the fieldset and legend HTML tags because I like the way they make the HTML form look (they add a box around the form with a title at top).

8. Complete the form.

The first tag closes the fieldset that was opened in Step 3. Then a submit button is created and centered using a div tag. Finally the form is closed. 5 The complete form, which requests some basic information from the user. 9. Complete the HTML page. 10. 5). html extension. php extension without harm (since code outside of the PHP tags is treated as HTML). 37 Creating an HTML Form ➝ ”Submit My Information” />

Chapter 2 Handling an HTML Form Handling an HTML Form Now that the HTML form has been created, it’s time to write a bare-bones PHP script to handle it.

Php ➝ quantity widget(s) at a cost 6 ➝ of \$$price each.

\n”; 11 $quantity = 30; // Buying 30 widgets. In the original script, the results were printed using single quotation marks and concatenation. The same result can be achieved using double quotation marks. When using double quotation marks, the variables can be placed within the string. 34 comes from a variable) would suggest that you would code $$var. 05; // 5% sales tax. 14 15 // Calculate the total. 16 $total = $quantity * $price; 17 $total = $total + ($total * $taxrate); // Calculate and add the tax.

Download PDF sample

PHP 6 and MySQL 5 for dynamic Web sites by Larry Ullman

by Steven

Rated 4.73 of 5 – based on 14 votes