143
استخدام ما تعلمناه في تطبيق سلة تسوق بسيط...
البرنامج النصي dbmanage.php (تابع)
114. 115.
} elseif ($HTTP_POST_VARS["submit"] == "Update Item") { $sql = "update inventory set name='"
$HTTP_POST_VARS["name"] .$HTTP_POST_VARS["category"}
116.
category='"
code='"
$HTTP_POST_VARS["code"]
.", description='"
117.
$HTTP_POST_VARS["description"]
་ ་
·
price='"
$HTTP_POST_VARS["price"]
118.
$HTTP_POST_VARS["picture"]
11
qty="
•
119.
10 1
"', picture
$HTTP_POST_VARS["qty"]
where id='"
$HTTP_POST_VARS["id"]
120.
} elseif($HTTP_POST_VARS["submit"]
== "Delete
Category") {
121.
122.
123.
124.
$sql = "delete from category where id=
$HTTP_POST_VARS["id"] .
$delete_cat_items
} elseif($HTTP_POST_VARS["submit"] == "Update Category") { $sql "update category set name='" $HTTP_POST_VARS["name"] .", description='"
= "true";
125.
$HTTP_POST_VARS["description"]
where id='"
126.
}
127.
128.
$HTTP_POST_VARS["id"]
$result = $dbconn->query($sql);
errortrap ($result);
129.
echo "<h2>"
$HTTP_POST_VARS["submit"]
Successful!</h2>\n";
130.
131.
if ($delete_cat_items == "true") {
$sql2
$HTTP_POST_VARS["id"]
132.
= "delete from inventory where category =
$result = $dbconn->query($sql2);
133.
errortrap ($result);
134.
135.
//}
}
136. } //end process_item_edit
137.
138. function cat_edit() {
139.
global $dbconn;
ص١٤٣