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

[eluser]the_unforgiven[/eluser]
yes and sent to a controller function that is then sent to a model function tio insert in the db

Code:
Edit Client Form

<fieldset id="signin_menu">
      &lt;?php
    $attributes = array('class' => 'email', 'id' => 'loginform');
    echo form_open('admin/createmeeting', $attributes);
    
   echo form_hidden('CustomerID', $meeting->CustomerID);  // THIS IS WHAT I NEED TO GET TO THE DB
   $date = array('name' => 'MeetingDate', 'id' => 'date');
   $client = array(
       'name'        =>  'CustomerID',
             'value'       =>  $query->Contact1,
             'readonly'    => 'readonly'
   );
   ?&gt;
  
   <table>
    
    <tr><td>Date:</td><td>&lt;?php echo form_input($date); ?&gt;</td><td><small>Format: (month-day-year)</small></td></tr>
    <tr><td>Client:</td><td>&lt;?php echo form_input($client); ?&gt;</td><td>ClientID:</td><td>&lt;?php echo $meeting->CustomerID ?&gt;</td></tr>
  
    <tr><td>Remarks:</td><td>&lt;?php echo form_textarea('Remarks'); ?&gt;</td></tr>
    <tr><td>Cuttings:</td><td>&lt;?php echo form_textarea('Cuttings'); ?&gt;</td></tr>
    <tr><td>Date Entered:</td><td><strong>&lt;?php echo $query->DateEntered; ?&gt;</strong></td></tr>
   </table>
   &lt;?php echo form_submit('submit', 'Create New Meeting'); ?&gt;
   &lt;?php echo form_close();?&gt;
  
   </fieldset>
Code:
Controller

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)
  {
   // Activate the add meeting model
   $this->meeting_model->addNewMeeting();
  }
  else {
   echo 'Something wasnt right';
  }
}
Code:
Model

function addNewMeeting()
{
  $meeting = $this->getMeetingRows();
  
  $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->db->insert('tblmeeting', $data);
  $d['meeting'] = $this->session->set_flashdata('meeting', 'The meeting has been successfully saved');
  redirect('admin/updateclient/'.$meeting['CustomerID'], $d);
}


Messages In This Thread
Input hidden - by El Forum - 01-31-2012, 02:18 PM
Input hidden - by El Forum - 01-31-2012, 02:32 PM
Input hidden - by El Forum - 01-31-2012, 02:35 PM
Input hidden - by El Forum - 01-31-2012, 02:36 PM
Input hidden - by El Forum - 01-31-2012, 02:46 PM
Input hidden - by El Forum - 01-31-2012, 02:49 PM
Input hidden - by El Forum - 01-31-2012, 02:50 PM
Input hidden - by El Forum - 01-31-2012, 02:53 PM
Input hidden - by El Forum - 01-31-2012, 02:53 PM
Input hidden - by El Forum - 01-31-2012, 02:55 PM
Input hidden - by El Forum - 01-31-2012, 02:56 PM
Input hidden - by El Forum - 01-31-2012, 02:59 PM
Input hidden - by El Forum - 01-31-2012, 03:00 PM
Input hidden - by El Forum - 01-31-2012, 03:03 PM
Input hidden - by El Forum - 01-31-2012, 03:08 PM
Input hidden - by El Forum - 01-31-2012, 03:13 PM
Input hidden - by El Forum - 01-31-2012, 03:16 PM
Input hidden - by El Forum - 01-31-2012, 03:19 PM
Input hidden - by El Forum - 01-31-2012, 03:32 PM
Input hidden - by El Forum - 01-31-2012, 03:46 PM
Input hidden - by El Forum - 01-31-2012, 03:49 PM
Input hidden - by El Forum - 01-31-2012, 03:51 PM
Input hidden - by El Forum - 01-31-2012, 03:52 PM
Input hidden - by El Forum - 01-31-2012, 03:58 PM
Input hidden - by El Forum - 01-31-2012, 04:03 PM
Input hidden - by El Forum - 01-31-2012, 04:06 PM
Input hidden - by El Forum - 01-31-2012, 04:24 PM
Input hidden - by El Forum - 02-01-2012, 02:15 AM
Input hidden - by El Forum - 02-01-2012, 02:18 AM
Input hidden - by El Forum - 02-01-2012, 02:46 AM
Input hidden - by El Forum - 02-01-2012, 02:51 AM
Input hidden - by El Forum - 02-01-2012, 02:58 AM
Input hidden - by El Forum - 02-01-2012, 03:02 AM
Input hidden - by El Forum - 02-01-2012, 03:10 AM
Input hidden - by El Forum - 02-01-2012, 04:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB