Welcome Guest, Not a member yet? Register   Sign In
Need Help With Form Submission
#10

[eluser]CroNiX[/eluser]
Each date should have its own puid, but the same locationid. So in your post data, there should be 4 puids, 4 dates and 1 locationid (since they all share the same location). You will need to keep track of what puid belongs to each date, maybe each (puid1, puid2, etc) in a hidden form field.

Then your updates would look something like:
Code:
$locationid = $this->input->post('locationid');
$puid1 = $this->input->post('puid1');
$date1 = strtotime($this->input->post('Dates1'));
$puid2 = $this->input->post('puid2');
$date2 = strtotime($this->input->post('Dates2'));

//update date1
$this->db
  ->where('puid', $puid1)
  ->where('locationid', $location_id)
  ->update('pudates', array('dates' => $date1));

//update date2
$this->db
  ->where('puid', $puid2)
  ->where('locationid', $location_id) //again, this isn't REALLY needed since PUID is unique
  ->update('pudates', array('dates' => $date2));
//repeat for other 2

Note, this isn't how I would actually do it. 4 queries is inefficient but I wanted to show you where you are going wrong. I'd look into update_batch() to do this in a single query instead of 4.


Messages In This Thread
Need Help With Form Submission - by El Forum - 03-19-2012, 11:43 AM
Need Help With Form Submission - by El Forum - 03-19-2012, 12:56 PM
Need Help With Form Submission - by El Forum - 03-19-2012, 03:00 PM
Need Help With Form Submission - by El Forum - 03-19-2012, 03:33 PM
Need Help With Form Submission - by El Forum - 03-19-2012, 03:40 PM
Need Help With Form Submission - by El Forum - 03-19-2012, 04:03 PM
Need Help With Form Submission - by El Forum - 03-19-2012, 04:15 PM
Need Help With Form Submission - by El Forum - 03-19-2012, 04:44 PM
Need Help With Form Submission - by El Forum - 03-20-2012, 12:26 PM
Need Help With Form Submission - by El Forum - 03-20-2012, 12:48 PM
Need Help With Form Submission - by El Forum - 03-20-2012, 02:06 PM
Need Help With Form Submission - by El Forum - 03-20-2012, 02:15 PM
Need Help With Form Submission - by El Forum - 03-21-2012, 01:30 PM
Need Help With Form Submission - by El Forum - 03-21-2012, 03:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB