Question: Calculating a Table Revisit the table you calculated in unit 4. Recall that this script uses client-side JavaScript. The way it works, the web server
Calculating a Table
Revisit the table you calculated in unit 4. Recall that this script uses client-side JavaScript. The way it works, the web server sends both the XHTML and the JavaScript to the client's web browser. The browser then executes the JavaScript to produce additional XHTML, which it then renders on the screen.
Rewrite the program to use server-side PHP instead. The syntax of PHP is similar to that of JavaScript; keep in mind the following differences:
PHP uses the print function instead of JavaScript's document.write function.
PHP prefixes a dollar sign ($) on every variable name.
PHP encloses its code in tags, where JavaScript uses .
JavaScript and PHP provide different function libraries. For example, the JavaScript Math.round()and the PHP round() functions work differently.
JavaScript uses "+" to concatenate strings while PHP substitutes values for variables inside a string. With PHP, you cannot calculate and concatenate in one statement.
Submit your pages to the W3C validator (http://validator.w3.org/) and correct all errors.
Submitting a Form
Web developers frequently use PHP to process forms. XHTML forms offer two different methods for communicating form values to a web server: get and post. The server handles both methods similarly by placing the input values into elements of an implicitly declared array, $_GET and $_POST, respectively. In your PHP code, to access a value, use the name of the input field as the subscript. For example, the value of the name form field is either $_GET["name"] or $_POST["name"], depending on the submission method.
The get and post methods differ on the client side. In the get method, the browser appends the field names and values to the URL, like this:
http://localhost/unit6/toys.php?Name=Mystery+Shopper&Age=99&Item=2
The post method transmits the field names and values as part of the XHTML header data and so the user cannot easily see or modify this information.
Open your catalog page from unit 4 in a text editor. Update the form tag to include method="post" or method="get". In the action attribute, specify the name of a page that will process the submitted form. Finally, write content for the page you specified. In this case, simply confirm receipt of the order, the date, and all of the field values.
Submit your pages to the W3C validator (http://validator.w3.org/) and correct all errors. (Note: You may ignore an error concerning placement of the script element.) Include screenshots of the results in your submission. Also include the full XHTML code for each page, and screenshots of the pages as your web browser displays them. Summarize the steps you followed to create and perfect the website. Outline the difficulties you encountered and how you resolved them.
My XHTML file from Unit 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
