chapter01 Bob'store




 

 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 2 <HTML>
 3  <HEAD>
 4   <TITLE> 不知道起什么名的论坛 </TITLE>
 5   <META NAME="Generator" CONTENT="EditPlus">
 6   <META NAME="Author" CONTENT="">
 7   <META NAME="Keywords" CONTENT="">
 8   <META NAME="Description" CONTENT="">
 9  </HEAD>
10 
11 <BODY>
12   论坛首页
13  <form action="processorder.php" method="post">
14  <table border="1">
15  <tr bgcolor="#cccccc">
16     <td width="150">Item</td>
17     <td width="15">Quantity</td>
18  </tr>
19  <tr>
20     <td>Tires</td>
21     <td><input type="text" name="tireqty"></td>
22  </tr>
23 <tr>
24     <td>Oil</td>
25     <td><input type="text" name="oilqty"/></td>
26   </tr>
27 <tr>
28     <td>Spark plugs</td>
29     <td><input type="text" name="sparkqty"/></td>
30 </tr>
31 <tr>
32     <td>How did you find Bob' ?</td>
33     <td><select name= "find">
34         <option value="a">I'm a regular customer</option>
35         <option value="b">TV adversion</option>    
36         <option value="c">Phone directory</option>
37         <option value="d">word of mouth</option>
38         </select>
39     </td>
40 </tr>
41 <tr>
42     <td colspan="2" align="center"><input type="submit" value="Submit Order"/></td>
43 </tr>
44 
45   </table>
46   </form>
47  </BODY>
48  <SCRIPT LANGUAGE="JavaScript">
49   
50  </SCRIPT>
51 </HTML>

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> freight </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>
 <table>
 <tr bgcolor="#cccccc">
    <td>Distance</td>
    <td>Cost</td>
 </tr>
    <?php
    $distance=50;
    while($distance<=250){
        echo"<tr>
        <td align=\"right\">".$distance."</td>
        <td align=\"right\">".($distance/10)."</td>
        </tr>\n";
        $distance+=50;
    }
    
    ?>
</table>
 </BODY>
 <SCRIPT LANGUAGE="JavaScript">
  
 </SCRIPT>
</HTML>

 

<html>
<head>
<title>Bob' Auto Parts - Order Results</title>
</head>
<body>
<?php
 //create  variable
 $tireqty = $_POST['tireqty'];
 $oilqty = $_POST['oilqty'];
 $sparkqty = $_POST['sparkqty'];
?>
<h1>Bob' Auto Parts</h1>
<h2>Order Results</h2>
<?php 
    echo"<p>Order processed at ".date('H:i js F')."</p>";
    //echo '<p>your order is as follows:</p>';
    //echo $tireqty.'tires</br>';
    //echo "$tireqty tires</br>";
    //echo $oilqty.'bottles</br>';
    //echo $sparkqty.'spark plugs</br>';

    $totalqty = 0;
    $totalamout = 0.00;

    define('TIREPRICE',100);
    define('OILPRICE',10);
    define('SPARKPRICE',4);
    $totalqty = $tireqty + $oilqty + $sparkqty;
    $totalamout = $tireqty*TIREPRICE 
                + $oilqty*OILPRICE
                + $sparkqty*SPARKPRICE;

    echo "Items order : $totalqty</br>";
    echo "Subtaotal: $".number_format($totalamout,2)."<br/>";

    $taxrate = 0.10;  //local tax10%
    $totalamout = $totalamout*(1+$taxrate);
    echo "Total include tax :$".number_format($totalamout,2)."<br/>";
     //where customer from
    $find = $_POST['find'];
    /*echo "$find";
    switch($find){
     case "a":
      echo "regular customer";
      break;
     case "b":
      echo "customer by tv";
      break;
     case "c":
      echo "customer by Phone";
      break;
     case "d":
      echo "customer by word of mouth";
      break;
     default:
      echo "we  do not know";
    
    }*/
    if($find == "a"){
      echo "<p>Regular Customer</p>";
    }elseif ($find == "b"){
      echo "<p>Customer by TV </p>";
    }elseif ($find == "c"){
        echo "<p>Customer by phone</p>";
    }elseif ($find == "d"){
        echo "<p>Customer by word of mouth</p>";
    }else {
        echo "<p>we do not know</p>";
    }
    
?>
</body>
</html>

 

posted @ 2016-09-17 17:02  薛鹏  阅读(107)  评论(0编辑  收藏  举报