Guest User

Untitled

a guest
Jan 15th, 2019
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. function update_customer($id){
  2.  
  3. $data['success']=0;
  4. if($_POST){
  5. $data_customer=array(
  6. 'first_name'=>$_POST['first_name'],
  7. 'last_name'=>$_POST['last_name'],
  8. 'phone'=>$_POST['phone'],
  9. 'email'=>$_POST['email'],
  10. 'website'=>$_POST['website'],
  11. 'business_name'=>$_POST['business_name'],
  12. 'business_add'=>$_POST['business_add'],
  13. 'business_cityState'=>$_POST['business_cityState'],
  14. 'cc_type'=>$_POST['cc_type'],
  15. 'cc_number'=>$_POST['cc_number'],
  16. 'cc_exp'=>$_POST['cc_exp'],
  17. 'cc_cvd'=>$_POST['cc_cvd'],
  18. 'billing_add'=>$_POST['billing_add'],
  19. 'billing_zip'=>$_POST['billing_zip'],
  20. 'package'=>$_POST['package'],
  21. 'assigned_zip_code'=>$_POST['assigned_zip_code'],
  22. 'active'=>1
  23. );
  24. $this->customer->update_customer($id,$data);
  25. $data['success']=1;
  26. }
  27. $data['customer']=$this->customer->get_customer($id);
  28.  
  29. $this->load->view('header');
  30. $this->load->view('edit_customer',$data);
  31. $this->load->view('footer');
  32. }
  33.  
  34. function update_customer($id, $data){
  35. $this->where('id', $id);
  36. $this->db->update('customers', $data);
  37. }
  38.  
  39. <?php if($success==1){ ?>
  40. <div class="successAlert">This customer has been updated.</div>
  41. <? } ?>
  42.  
  43. <div class="mainForm">
  44. <?php echo validation_errors(); ?>
  45.  
  46. <form action="<?=base_url()?>customers/update_customer/<?=$customer['id']?>" method="post">
  47.  
  48. <label for="first_name">First Name:</label>
  49. <input type="input" name="first_name" value="" /><br />
  50. <hr>
  51.  
  52. $data_customer = $_POST;
  53. $data_customer['active'] = 1;
Add Comment
Please, Sign In to add comment