6 The following table shows three superglobal arrays used by PHP to pass pre

6 the following table shows three superglobal arrays

This preview shows page 63 - 65 out of 65 pages.

6 The following table shows three superglobal arrays used by PHP to pass pre-defined variables to a script. _SERVER Server environment variables. _GET Data submitted via HTTP GETmethod. _POST Data submitted via HTTP POSTmethod.
Background image
60COMP S834 Web Server Technology Self-test 3.5 1 The output of the following code is as follows: My Calculator 5 2 The output of the following code will be Your name is Lim, Jenny. followed by a line feed. Note that the line feed will not show up within a Web browser unless you use the <BR> tag. <!DOCTYPE html> <html> <body> <p>My Calculator</p> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = 2 + 3; </script> </body> </html> 3 The output is a ‘Try’ button. After the user clicks the button, the message ‘Welcome John!’ is shown. Here is the screenshot of the output: 4 The output is a ‘Try’ button. After the user clicks the button, the message ‘Welcome Ann, the Winner.’ is shown. Here is the screenshot of the output:
Background image
Unit 3 615 The four advantages of JavaScript are as follows: Advantage Interactivity JavaScript can be coded for small interactions, such as drop-down menus, as well as large interactions, such as chat rooms Compatibility The same scripts can be run in most major Web browsers such as Chrome, Firefox, IE and Safari. High response time JavaScript is executed in a Web browser; it is therefore quick to load from a webpage because the browser does not need to wait for the reply from a Web server. Low development cost You can code your scripts straight into your HTML code using a text editor such as Notepad and upload the webpage to your website without the need for any special editors or software with which to work. Self-test 3.6 1 The code used to send HTTP POSTrequest: xmlhttp.open("POST","query.php",true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send("product=apple&price=200"); 2 xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==2 && xmlhttp.status==404){ document.getElementById("myCode").innerHTML=xmlhttp.responseText; } } 3 The three advantages of AJAX are as follows: Advantage High response time Users do not need to wait for reloading the whole webpage for every little thing that requires server-side processing. Reduced network traffic Only a small amount of data is sent between the server and the client. Reduced server workload The server only needs to process the data required for parts of the webpage.
Background image

You've reached the end of your free preview.

Want to read all 65 pages?

  • Spring '18
  • World Wide Web, Web server, Hypertext Transfer Protocol, Server-side scripting

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture