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

[eluser]vincej[/eluser]
Hi CroxNix - Thanks so much for riding over the hill and coming to the rescue ! apologies for being such a Dufus .

following your recommendations I have made some alterations to the code - I hope correctly and in the right places. I seem to be impacting the DB now as all the existing test dates have been set to 0 and the locationid is now set to a single location.

However, on the not so good front, I'm still deep in the weeds with several errors. The DB is being updated with a single location, and the dates themselves are not getting through. My CI form is also now giving me lots of 'Undefined Offset'. I'm also not getting hardly anything off the Post array:
Code:
Array ( [location] => Varsity [0] => Wed 31 Dec 1969 [locationid] => 2 [submit] => Save Changes )


Here is the current:
View:

Code:
<?php
echo form_open('admin/pickup_detail/Updatelocation');
?>

<table width="800" border="" cellpadding="5" align="center"  >
  <tr>
    <th width="10" scope="col">Pick Up ID</th>
    <th  width="75" scope="col">Location</th>
    <th width="75" scope="col">Date 1 </th>
    <th width="75" scope="col">Date 2 </th>
    <th width="75" scope="col">Date 3</th>
     <th width="75" scope="col">Date 4</th>
    <th width="75" scope="col">Delete</th>
&lt;?php
foreach ($pickupdates as $item) {
   $theDates = explode(',', $item['TheDates']);
  ?&gt;
<tr align="center">
  <td width="100" align="center">&lt;?php echo  $item['locationid'];?&gt;</td>
    <td width="100" align="center">&lt;?php $data = array('name'=>'location', 'size'=>20,'value' => $item['location']); echo form_input($data); ?&gt;</td>
    <td width="100">&lt;?php $data = array('name'=> $theDates[0],'size'=>15,'value' =>(strftime("%a %d %b %Y",$theDates[0]))); echo form_input($data); ?&gt;</td>
    <td width="100">&lt;?php $data = array('name'=> $theDates[1],'size'=>15,'value' =>(strftime("%a %d %b %Y",$theDates[1]))); echo form_input($data); ?&gt;</td>
    <td width="100">&lt;?php $data = array('name'=>$theDates[2],'size'=>15,'value' => (strftime("%a %d %b %Y",$theDates[2]))); echo form_input($data); ?&gt;</td>
    <td width="100">&lt;?php $data = array('name'=>$theDates[3],'size'=>15,'value' => (strftime("%a %d %b %Y",$theDates[3]))); echo form_input($data); ?&gt;</td>
    <td width="150"> &lt;?php echo anchor('admin/pickup_detail/deletelocation/'. $item['location'], 'Delete');?&gt;</td>

  </tr>
&lt;?php  ;} ?&gt;

</table>

&lt;?php
form_input($data);
echo form_hidden('locationid', $item['locationid']);
echo "<div class=submitted>". form_submit('submit','Save Changes')."</div>";
echo form_close();
?&gt;


Model
Code:
function Updatelocation(){
    foreach( $_POST as $pickupid=>$location) {
    $data = array(
  'locationid' => db_clean($_POST['locationid']),
  'dates' => db_clean($_POST['TheDates[0]']),
  'dates' => db_clean($_POST['TheDates[1]']),
  'dates' => db_clean($_POST['TheDates[2]']),
  'dates' => db_clean($_POST['TheDates[3]'])
    );
  $this->db->update('pudates',$data);
  $this->session->set_flashdata('message', 'Table Updated');
   }
  
  }


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