Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.31 KB | None | 0 0
  1. <!--Author:
  2.     Date:
  3.     File:   Modify3.php
  4.     Purpose:Chapter 6 Exercise
  5.  
  6.     REQUIREMENT: Write a Web-based application consisting of a Web form
  7.     (Modify3.html) and a PHP progam (Modify3.php).
  8.  
  9.     Modify3.html includes a form that consists only of a Submit button
  10.     When the button is pressed, Modify3.php runs and opens the file
  11.     tickets.txt which contains a list of three ticket orders.
  12.     The program reads the ticket order on the first line, multiplies this
  13.     by 6.50 (the price of each ticket) to get the cost of the sale, and
  14.     displays the cost of the sale.
  15.  
  16.     Modify Modify3.php so that it reads and displays all three ticket orders
  17.     and displays the cost of each sale AND also the total sales.
  18.  
  19. -->
  20.  
  21. <html>
  22. <head>
  23.     <title>Modify3</title>
  24.     <link rel ="stylesheet" type="text/css" href="sample.css" >
  25. </head>
  26. <body>
  27.  
  28.     <h1>Modify3</h1>
  29.  
  30.     <?php
  31.         $ticketFile = fopen("tickets.txt","r");
  32.         $ticketOrder1 = fgets($ticketFile);
  33.         $ticketOrder2 = fgets($ticketFile);
  34.         $ticketOrder3 = fgets($ticketFile);        
  35.         fclose($ticketFile);
  36.  
  37.         $ticketSale1 = $ticketOrder1 * 6.50;
  38.         $ticketSale2 = $ticketOrder2 * 6.50;
  39.         $ticketSale3 = $ticketOrder3 * 6.50;
  40.  
  41.         print("<p>TICKET SALE 1: $$ticketSale1</p>");
  42.         print("<p>TICKET SALE 2: $$ticketSale2</p>");
  43.         print("<p>TICKET SALE 3: $$ticketSale3</p>");
  44.     ?>
  45.  
  46. </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement