我使用codeigniter,我有双表单提交问题。我在2-3天前在google上寻找了一个解决方案,但我还是找不到。有人能帮助我吗?
shopping_cart.php
<?php
echo anchor("user/item_all", "Continue to shopping", array(
'class' => 'btn btn-info'
));
if ($this->cart->total_items() > 0):
if ($return_checkout) {
echo anchor("user/checkout", "Checkout", array(
'class' => 'btn btn-success pull-right',
'style' => "margin-left: 10px",
));
}
echo anchor("user/destroy_cart", "Delete All Cart", array(
'class' => 'btn btn-danger',
'style' => "margin: 0px 10px"
));
echo form_button(array(
'type' => 'submit',
'class' => 'btn btn-primary pull-right',
'style' => "margin: 0px 10px",
'content' => "Update Cart"
));
endif;
?>
user.php的
function checkout() {
$return_checkout = $this->session->userdata('poin') >= $this->cart->total() ? TRUE : FALSE;
$cart = $this->cart->contents();
if ($return_checkout AND count($cart) > 0) {
if ($this->mall->checkout($cart)) {
$this->cart->destroy();
redirect('user/shop_history');
}
}else
redirect('user/shop_history');
}
我希望有人可以帮助我。提前谢谢!