Welcome Guest, Not a member yet? Register   Sign In
Input hidden
#21

[eluser]the_unforgiven[/eluser]
like this?

Code:
function createmeeting()
  {
  var $data;
   // Form Validation
   $this->form_validation->set_rules('Date', 'Date', 'required');
   $this->form_validation->set_rules('Remarks', 'Remarks', 'required');
   $this->form_validation->set_rules('Cuttings', 'Cuttings', 'required');

   if ($this->form_validation->run() == FALSE)
   {
     $data = array(
        //'CustomerID'  => $meeting['CustomerID'],
     'CustomerID'  => $this->input->post('CustomerID'),
     'AgencyID'    => $this->input->post('AgencyID'),
     'MeetingDate' => $this->input->post('MeetingDate'),
     'Remarks'     => $this->input->post('Remarks'),
     'Cuttings'    => $this->input->post('Cuttings'),
     'DateEntered' => now()
   );

     $this->meeting_model->addNewMeeting($data);  
   }
   else {
    echo 'Something wasnt right';
   }
  }
#22

[eluser]ibnclaudius[/eluser]
No, like this:

Code:
class Model_name extends CI_Model
{
var $data;

//...

function createmeeting() { }

}
#23

[eluser]the_unforgiven[/eluser]
Parse error: syntax error, unexpected T_VAR in /Applications/MAMP/htdocs/ksd/application/controllers/admin.php on line 8
#24

[eluser]ibnclaudius[/eluser]
Try this:

Code:
//...

public $data = array();

//...

function createmeeting()
  {
   // Form Validation
   $this->form_validation->set_rules('Date', 'Date', 'required');
   $this->form_validation->set_rules('Remarks', 'Remarks', 'required');
   $this->form_validation->set_rules('Cuttings', 'Cuttings', 'required');

   if ($this->form_validation->run() == FALSE)
   {
     $this->data = array(
        //'CustomerID'  => $meeting['CustomerID'],
     'CustomerID'  => $this->input->post('CustomerID'),
     'AgencyID'    => $this->input->post('AgencyID'),
     'MeetingDate' => $this->input->post('MeetingDate'),
     'Remarks'     => $this->input->post('Remarks'),
     'Cuttings'    => $this->input->post('Cuttings'),
     'DateEntered' => now()
   );

     $this->meeting_model->addNewMeeting($this->data);  
   }
   else {
    echo 'Something wasnt right';
   }
  }
#25

[eluser]the_unforgiven[/eluser]
no errors, but still not inserting the CustomerID....
#26

[eluser]ibnclaudius[/eluser]
The other fields are being inserted?
#27

[eluser]limit[/eluser]
If your getting the $_POST[''] sent and its not inserting check your database "type" for that row. Maybe its not set right or your passing Varchar to INT()..

http://dev.mysql.com/doc/refman/5.0/en/s...rview.html
#28

[eluser]the_unforgiven[/eluser]
othe fields are inserting fine just the Customer ID one is just inserting a Zero
#29

[eluser]the_unforgiven[/eluser]
It cant be because passing Varchar to INT().. the field in the db is INT() but the passing data is number which is a INT() right?
#30

[eluser]limit[/eluser]
Correct, but in your output above you had

Code:
["CustomerID"]=> string(16) "MR Webber"

which made me think that was your problem.

Only other thing I can think of is its something with the field being "read only" or duplicate name fields in your html. This should be easy to narrow down just by viewing your page source and dumping your post vars.

Code:
print_r($this->input->post()); die();
//or
print_r($_POST); die();


Did you try hard-coding a value for CustomerID in your data array and see if it inserts?





Theme © iAndrew 2016 - Forum software by © MyBB