逻辑:我在下拉列表中有此范围选项。它的数字为1-12,表示客户将支付的月数。当我选择“1”时,没有问题,因为我只保存一个日期。但是如果我选择“2”,我应该能够保存两次相同的数据,并且日期将是连续的,所以一次点击就会有2个记录。 (例如:2013年9月9日和2013年10月9日)三个及以上相同。有人能帮我吗?这是在codeigniter中。感谢。
型号:
function add_payment($id, $keyid, $key, $paymentdate, $forpaymentdate, $datecreated, $subscription_type){
$this->db->set('keyid', $keyid);
$this->db->set('key',$key);
$this->db->set('paymentdate',$paymentdate);
$this->db->set('forpaymentdate',$forpaymentdate);
$this->db->set('userid','0');
$this->db->set('notified','0');
$this->db->set('subscription_type', $subscription_type);
$this->db->insert('payment');
}
控制器:
function save_payment(){
$id = @$_POST['id'];
$keyid = @$_POST['keyid'];
$key = @$_POST['key'];
$dateofpayment = @$_POST['dateofpayment'];
$forpaymentdate = @$_POST['forpaymentdate'];
$datecreated = @$_POST['datecreated'];
$subscription_type = @$_POST['subscription_type'];
//$userid = $_POST['userid'];
//$notified = $_POST['notified'];
$this->operation->add_payment($id, $keyid, $key, $dateofpayment, $forpaymentdate, $datecreated, $subscription_type);
die(redirect(base_url('system/payment?status=saved')));
}