我試圖用codeigniter提交表單,當我提交表單時得到一個空白頁。我哪裏做錯了?Codeigniter提交表單不工作,空白頁
查看
echo "<form class='order_ctn_parent' method='POST' action='add/insert_orders'>";
//inputs
echo "</form>";
控制器
class Add extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function index() {
}
public function insert_orders()
{
$this->load->model('order_model', 'order');
$this->order->insert_orders();
redirect('view_orders', 'location');
}
}
型號
class Order_model extends CI_Model {
public function insert_orders()
{
$DB2 = $this->load->database('orders', TRUE);
$timber_array = $this->input->post("timber_choose");
$products_array = $this->input->post("product_choose");
$qty_array = $this->input->post("quantity");
$price_array = $this->input->post("price");
$qty_array = $this->input->post("quantity");
$loop = 0;
foreach($products_array as $product) {
$price = str_replace("£","",$price_array[$loop]);
$data = array(
'product_code' => "",
'timber_type' => $timber_array[$loop],
'product' => $product,
'quantity' => $qty_array[$loop],
'price' => $price
);
$DB2->insert('timber_order_products', $data);
$loop++;
}
}
}
這些用戶指南鏈接將有助於形式submi tting http://www.codeigniter.com/user_guide/libraries/form_validation.html和http://www.codeigniter.com/user_guide/helpers/form_helper.html – user4419336