153
استخدام ما تعلمناه في تطبيق سلة تسوق بسيط..
البرنامج النصي ..admin.php (تابع)
100.
101.
<tr><td>Order ID</td><td><?= $r["id"]?></td></tr>
<tr><td>Status (current status is
<b><?=$r["status"]?></b>)</td>
102.
<td>
103.
<select name="status">
104.
105.
106.
107.
<option value="open">Open</option>
<option value="shipped">Shipped</option>
<option value="hold">Hold</option>
<option value="backorder">Backorder</option>
108.
</select>
109.
</td></tr>
110.
111.
112.
<tr><td>Tracking Number</td><td><input type="text" name="tracking" value="<?=$r["tracking"]?>"></td></tr>
<input type=hidden name="id" value="<?=$r["id"]?>"> <input type=hidden name="customer" value="<?=$r["customer"]?>"> !
113. <tr><td colspan=2><input type="submit" name="update" value="Update Order!"></td></tr>
114. </table>
115.
116.
</form>
<?
117. } //end update_order
118.
119. function update_order_process ($HTTP_POST_VARS) { 120. global $dbconn;
121.
$sql = "update orders set status= $HTTP_POST_VARS["status"]
$HTTP_POST_VARS["tracking"] $HTTP_POST_VARS["id"] .
tracking_number='" HI where id='"
122. $result = $dbconn->query($sql); 123.
errortrap ($result);
124. $message = "Your order from "
COMPANY_NAME
#
has been
processed. It's current status is: \n";
125, $message = "Status: " . $HTTP_POST_VARS["status"] 126.
if($HTTP_POST_VARS["tracking"] != "") {
127. $message = "The tracking number for your shipment is $HTTP_POST_VARS["tracking"]
128. }
129.
"\n";
$r_cust get_customer ($HTTP_POST_VARS["customer"]);
"\n";
ص١٥٣