function handle_request($method, $request) { switch ($method) { case 'PUT': request_put($request); break; case 'POST': return $this->request_get($request); break; case 'GET': return $this->request_get($request); break; case 'DELETE': request_delete($request); break; default: return "error"; // request_error($request); break; } }
if ($result) { get_form($result, $index); } // end if - $result } // end isset() - editpost ?> </form> <?php //delete one row of table post if (isset($_GET['post']) && $_GET['action'] == 'deletepost') { $index = $_GET['action']; $id = $_GET['post']; $result = request_delete($index, $id); if ($result) { $delete = "?delete=" . $result->rowCount(); header("location:viewpost.php{$delete}"); } // end if } // end isset() - deletepost ?> <?php // update one row of table post if press click *Update* if (isset($_POST['Update'])) { $index = "editpost"; $update = array("post_id" => "{$_POST['post_id']}", "post_title" => "{$_POST['post_title']}", "post_content" => "{$_POST['post_content']}", "post_category" => "{$_POST['post_category']}", "post_author" => "{$_POST['post_author']}", "post_date" => "{$_POST['post_date']}", "post_status" => "{$_POST['post_status']}", "post_comment" => "{$_POST['post_comment']}"); $result = request_update($index, $update);