echo '{"result":0,message:"unknown command"}'; exit; } $cmd = $_REQUEST['cmd']; switch ($cmd) { case 1: get_product(); break; case 2: delete_product(); break; case 3: //edit break; case 4: search_product(); break; case 5: getProdsByManufacs(); break; default: echo '{"result":0,message:"unknown command"}'; break; } function get_product() { include "products.php"; $obj = new products(); $id = $_REQUEST['id']; $row = $obj->get_product($id); //return a JSON string to browser when request comes to get description
<?php $k = $_GET["k"]; $sotin1trang = 12; $trang = $_GET["trang"]; settype($trang, "int"); if ($trang <= 0) { $trang = 1; } $tongtin = search_product($k); $tongsotin = mysql_num_rows($tongtin); $sotrang = ceil($tongsotin / $sotin1trang); ?> <div class="title_style">TÌM KIẾM SẢN PHẨM</div> <div class="wrap_page_act"> <div class="search_block"> <form action="main-page.php" name="form_search" id="form_search"> <div style="padding:20px; line-height:25px"> <label>Tìm kiếm sản phẩm</label> <input type="hidden" name="p" value="search-product" /> <input type="text" name="k" placeholder="Nhập tên sản phẩm cần tìm..."> <input type="submit" class="button_style1" value="Tìm kiếm" /> </div> </form> </div> <div id="usual1" class="usual"> <ul> <li><a href="#tab1">SẢN PHẨM</a></li> </ul> <div class="tab_content" id="tab1">