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

COMPUTER SOFTWARE APPLICATION - CITS




















           TASK 2: Using the else clause with if statement
              1  Open the text editor
              2  Write the following codes
                 <html>
                 <body>
                    <?php
                      $age = 21;
                      if ($age>=18)
                      {
                         echo “You are eligible for DL”;
                      }
                      else
                      {
                         echo “You are NOT eligible for DL”;
                      }
                    ?>
                 </body>
                 </html>

              3  Save the program in C:\Apache24\htdocs in a folder with .php extension
              4  Run the Apache services from windows services
              5  Open the browser and type the following address
                 http://localhost/foldername/

              6  Click the php file to run  and verify the output



























                                                           227

                               CITS : IT & ITES - Computer Software Application - Exercise 51
   237   238   239   240   241   242   243   244   245   246   247