note 111992 deleted from debugger by aharvey
| From: | aharvey@php.net | Date: | Fri, 19 Apr 2013 19:27:55 +0000 |
| Subject: | note 111992 deleted from debugger by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194568@lists.php.net to get a copy of this message | ||
Note Submitter: ashley dot giesel at yahoo dot com
----
<?php
//create short variable name
$$DOCUMENT_ROOT = $SERVER ['Vieworder.html'];
?>
<html>
<head>
<title>Sour Soda - Customer Orders</title>
</head>
<body>
<h1>Sour Soda</h1>
<h2>Customer Orders</h2>
<?php
//read in the entire file.
//each order becomes an element in the array
$orders=file("$DOCUMENT_ROOT/../vieworder.html");
//count the number of orders in the array
$number_of_orders=count($orders);
if ($number_of_orders==0){
echo"<p><strong>No orders pending.
Please try again later.</strong></p>";
}
echo "<table border=\"1\">\n";
echo "<tr><th bgcolor=\"#CCCCFF\">Order Date</th>
<th bgcolor=\"#CCCCFF\">Cherry</th>
<th bgcolor\"#CCCCFF\">Raspberry</th>
<th bgcolor\"#CCCCFF\">Watermelon</th>
<th bgcolor\"#CCCCFF\">Apple</th>
<th bgcolor\"#CCCCFF\">Blueraspberry</th>
<tr>";
for ($i=0; $i<$number_of_orders; $i++){
//split up each line
$line = explode("\t",$orders[$i]);
//keep only the number of items ordered
$line[1]=intval($line[1]);
$line[2]=intval($line[2]);
$line[3]=intval($line[3]);
$line[4]=intval($line[4]);
$line[5]=intval($line[5]);
//output each order
echo "<tr>
<td>".$line[0]."</td>
<td align=\"right\">".$line[1]."</td>
<td align=\"right\">".$line[2]."</td>
<td align=\"right\">".$line[3]."</td>
<td align=\"right\">".$line[4]."</td>
<td align=\"right\">".$line[5]."</td>;
<td>".$line[6]."</td>
</tr>";
}
echo "</table>";
?>
</body>