Page 298 - Computer Software Application TP - Volume 1
P. 298

COMPUTER SOFTWARE APPLICATION - CITS




           EXERCISE 56 : Work With Forms - Super global variables
                                     the server array  A script to  acquire user

                                     input, importing user input Accessing user

                                     input, Combine HTML and PHP code., using
                                     hidden fields



            Objectives

           At the end of this exercise you shall be able to:
           •  acquire user input from a HTML form using PHP
           •  combine HTML and PHP code in single file
           •  create hidden feilds and access it using PHP.
           Requirements

           Tools/Materials

           •   computer/Laptop with latest configuration       •  PHP
           •   operating system: windows 10 or 11              •  Text editor
           •  apache web server                                •  web browser

           Procedure


           TASK 1: Super global variables the server array
           1  Open the text editor
           2  Write the following codes

                       <html >
              <head>
                   <title>$_SERVER Super Global</title>
              </head>

              <body>
                <h2>Server Information</h2>
                <ul>
                          <li>Server Name: <?php echo $_SERVER[‘SERVER_NAME’]; ?></li>
                          <li>Server Software: <?php echo $_SERVER[‘SERVER_SOFTWARE’]; ?></li>

                          <li>Server Protocol: <?php echo $_SERVER[‘SERVER_PROTOCOL’]; ?></li>
                          <li>Request Method: <?php echo $_SERVER[‘REQUEST_METHOD’]; ?></li>
                          <li>Request Time: <?php echo $_SERVER[‘REQUEST_TIME’]; ?></li>
                          <li>Request URI: <?php echo $_SERVER[‘REQUEST_URI’]; ?></li>
                          <li>Query String: <?php echo $_SERVER[‘QUERY_STRING’]; ?></li>

                          <li>User Agent: <?php echo $_SERVER[‘HTTP_USER_AGENT’]; ?></li>
                          <li>Remote Address: <?php echo $_SERVER[‘REMOTE_ADDR’]; ?></li>
                </ul>



                                                           283
   293   294   295   296   297   298   299   300   301   302   303