You have written scripts that run on the user’s client browser. These scripts are fast but…

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 webserver. 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 the 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 Assignment:

Revisit the table you calculated in unit 4. Recall that this script uses client-side JavaScript. The way it works, the webserver 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

    Below is my js code

    let supplies = [
    { Item: “knives”, Price: 50, Location: “Target” },
    { name: “pots & pans”, price: 200, place: “Bed Bath and Beyond” },
    { name: “cutting board”, price: 25, location: “Walmart” },
    { name: “measuring cups”, price: 12, location: “Lowes” },
    { name: “measuring spoons”, price: 9, location: “Target” }

    function generateTableHead(table, data) {
    let thead = table.createTHead();
    let row = thead.insertRow();
    for (let key of data) {
    let th = document.createElement(“th”);
    let text = document.createTextNode(key);

    function generateTable(table, data) {
    for (let element of data) {
    let row = table.insertRow();
    for (key in element) {
    let cell = row.insertCell();
    let text = document.createTextNode(element[key]);

    let table = document.querySelector(“table”);
    let data = Object.keys(supplies[0]);
    generateTableHead(table, data);
    generateTable(table, supplies);

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!