Thursday, 5 September 2013

Mutiple Sending of Data to Database Codeigniter

Mutiple Sending of Data to Database Codeigniter

Logic: I have this range option in dropdown. It has numbers from 1-12
which represents the number of months the client will pay. When I select
"1", there's no problem since I'll just be saving one date. But if I
select "2", I should be able to save same data twice and the date will be
in a consecutive manner so there will be 2records to be made in one click.
(Example: 9/9/13 and 10/9/13) Same goes with three and up. Can someone
help me? This is in codeigniter. Thanks.
Model:
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');
}
Controller:
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')));
}

No comments:

Post a Comment