public function actionInsert() { if (isset($_POST['submit']) && $_POST['submit'] == 'Insert Procuct') { $pro = new ProModel(); $pro->name = $_POST['product_name']; $pro->description = $_POST['product_desc']; $product_image = $_FILES['product_image']['name']; $product_image_tmp = $_FILES['product_image']['tmp_name']; move_uploaded_file($product_image_tmp, "img/{$product_image}"); $pro->image = $product_image; $pro->price = $_POST['product_price']; $pro->save(); header('Location: http://localhost/task/task2/admin_area/index.php'); exit; } if (isset($_POST['sub'])) { $user = new UserModel(); $user->first_name = $_POST['fn']; $user->last_name = $_POST['ln']; $user->email = $_POST['em']; $user->save(); $ord = new OrdersModel(); $ord->user_id = $_POST['id']; $ord->sum = $_POST['price']; $ord->order_date = date("Y/m/d h:i:s"); $ord->save(); $ordPro = new OrdersProModel(); $ordPro->order_id = $_POST['id']; $ordPro->product_id = $_POST['id']; $ordPro->qty = $_POST['quantity']; $ordPro->save(); header('Location: http://localhost/task/task2/admin_area/index.php'); exit; } }
function CreateOrdersTables($types) { $ordersModel = new OrdersModel(); $ordersArray = $ordersModel->GetOrdersByType($types); $result = ""; foreach ($ordersArray as $key => $orders) { $result = $result . "<table class = 'ordersTable'>\n <tr>\n \n \n \n <th width = '75px' >OrderId : </th>\n <td>{$orders->OrderId}</td>\n </tr>\n \n <tr>\n <th width = '75px' >Customer Name : </th>\n <td>{$orders->CustomerName}</td>\n </tr>\n \n <tr>\n <th>Address : </th>\n <td>{$orders->Address}</td>\n </tr>\n \n <tr>\n <th>Contact Number : </th>\n <td>{$orders->ContactNo}</td>\n </tr>\n \n \n <tr>\n <th>Book Name : </th>\n <td>{$orders->BookName}</td>\n </tr>\n \n\n\n \n \n \n\n\n <tr>\n <th>Book Name2 : </th>\n <td>{$orders->BookName2}</td>\n </tr>\n \n\n \n \n\n\n <tr>\n <th>Book Name3 : </th>\n <td>{$orders->BookName3}</td>\n </tr>\n \n\n \n\n \n \n\n \n <tr>\n <th>Order Date : </th>\n <td>{$orders->OrderDate}</td>\n </tr>\n \n\n \n \n \n </table>"; } return $result; }
public function actionInsert() { if (isset($_POST['sub'])) { $pro = new OrdersModel(); $pro->user_id = 1; $pro->sum = $_POST['price']; $pro->order_date = date("Y/m/d"); $pro->save(); header('Location: http://localhost/task/task2/admin_area/index.php'); exit; } }
public function actionAll() { $pro = UserModel::findALL(); $ord = OrdersModel::findAll(); $ordpro = OrdersProModel::findAll(); $view = new View(); $view->items = $pro; $view->orders = $ord; $view->ords = $ordpro; echo $view->display("order.php"); }