Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ApApplication Simple Server-Side Scripting You have written scripts that run on the user's client browser. These scripts are fast but unreliable. They are fast because

ApApplication Simple Server-Side Scripting You have written scripts that run on the user's client browser. These scripts are fast but unreliable. They are fast because they run entirely on the client's computer and do not require communication with the web server. However, the user can intercept and modify these scripts, and even disable them entirely. Therefore, the best practice is to use client-side scripts only to improve the user experience, but not to rely on them for correct behavior of the web page. Scripts that run on the server are more reliable. When configured correctly, the user never sees the scripts and cannot avoid or modify their behavior. The code of these scripts remains on the server. The user's browser sees only the XHTML content that the script produces. Server-side scripts are slightly less responsive to the user and put an additional processing burden on your web server. Nevertheless, they are much more secure and reliable than client-side scripts. In this unit you apply the PHP language to create server-side scripts. To prepare for this Application: 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

6. What is a due date?

Answered: 1 week ago