Welcome Guest, Not a member yet? Register   Sign In
Need help posting drop down form into DB via $_POST
#1

[eluser]vincej[/eluser]
Hi !

I keep getting a PHP error message "Undefined Index: DeliveryID" coming off my model function createCustomer() featured below.

The form and the model function works great with all the other static form_input I have ( not included for clarity ) however I keep getting the above error message with the drop_down.

Form_dropdown :

Code:
<?php

echo form_open('admin/customer_reg/create');
echo "<p class='pickup' ><label for='DeliveryID'>Preferred Collection Point</label><br/>";
$DeliveryID = array('1'=>'Varsity',
   '2' => 'Westbrook',
   '3'=> 'Crowfoot',
   '4'=> 'Canmore',
   );
echo form_dropdown('pickup', $DeliveryID,'Varsity')."</p>" ;

echo form_submit('submit','create account');
echo form_close();

       ?&gt;





Code:
function createCustomer(){
              $data = array( 'DeliveryID'  => db_clean($_POST['DeliveryID'],25),);
  
              $this->db->insert('customer',$data);
      
              $new_customer_id = $this->db->insert_id();
      }


I have triple checked the DB to ensure things are spelt right and capitalised right. I have also tried changing 'DeliveryID' to $DeliveryID and that didn't help.

My theory is that I have got the syntax wrong when using a $_POST and the $DeliveryID array since essentially I am trying to put an array into an array then hope that the $this->db->insert() function pulls out the value correctly.

I have tried checking the forums adn wiki to no avail.

any ideas - this shoudl be a beginner level solution - I hope ! :o)

MANY THANK vincej




Messages In This Thread
Need help posting drop down form into DB via $_POST - by El Forum - 10-10-2011, 06:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB