• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
input->post not working

#1
[eluser]zenonn[/eluser]
hi,
I am new to CI, and seem to having a strange issue. I can use the $_POST var to get values from forms. As soon as I try to use input->post('var'), I get nothing to returned to the controller.
Here is the code

Controller:
Code:
function customer_insert()
    {
        
        
        $first_name = $this->input->post('first_name');
        $last_name = $this->input->post('last_name');
        $email = $this->input->post('email');
        $phone = $this->input->post('phone');
        $address = $this->input->post('address');
        $city = $this->input->post('city');
        $state = $this->input->post('state');
        $zip = $this->input->post('zip');
        $account = $this->input->post('account');
      
        
        $data = array(
        
        'first_name' => '$first_name',
        'last_name'  => '$last_name',
        'email' => '$email',
        'phone' => '$phone',
        'address' => '$address',
        'city' => '$city',
        'state' => '$state',
        'zip' => '$zip',
        'account' => '$account',    
        
        
        
        );
        
    
        $this->account_model->insert_customer($data);
        
        
        redirect('customers/accounts');
    }
Model:
Code:
<?php
class Account_model extends Model
{
     function __construct()
    {
    parent::Model();
    }
    
    function get_all_accounts($word)
    {
    echo "Database". ' ' .$word;    
    $myData = $this->db->get($word);
    return $myData->result();
    }
    
    function insert_customer($data)
    {
        
        
        $this->db->insert('customers',$data);
    }
}

?>
form:
Code:
<div id="form">
            &lt;?=form_fieldset();?&gt;
            <legend>Customer Account Details</legend>
            &lt;?= form_open('customers/customer_insert');?&gt;
            <p>x
            &lt;?=form_label("First Name:(Required)","first_name");?&gt;
            &lt;?=form_input('first_name','');?&gt;
            </p>
            <p>
            &lt;?=form_label('Last Name:(Required)','Last_name');?&gt;
            &lt;?=form_input('last_name','');?&gt;
            </p>
            <p>
            &lt;?=form_label('Email:(Required)','email');?&gt;
            &lt;?=form_input('email','');?&gt;
            </p>
            &lt;?=form_fieldset_close();?&gt;
            &lt;?=form_fieldset();?&gt;
            <legend>Customer Address Details</legend>
            <p>
            &lt;?=form_label('Phone:(Required)','phone');?&gt;
            &lt;?=form_input('phone','');?&gt;
            </p>
            <p>
            &lt;?=form_label('Address:(Required)','address');?&gt;
            &lt;?=form_input('address','');?&gt;
            </p>
            <p>
            &lt;?=form_label('City:(Required)','city');?&gt;
            &lt;?=form_input('city','');?&gt;
            </p>
            <p>
            &lt;?=form_label('State:(Required)','state');?&gt;
            &lt;?= form_input('state','');?&gt;
            </p>
            &lt;?=form_label('Zip Code:(Required)','zip');?&gt;
            &lt;?=form_input('zip','');?&gt;
            &lt;input type="hidden" name="account" value="&lt;?= rand(1000,50000); ?&gt;"&gt;
            <p>
            &lt;?=form_submit('','Submit Data');?&gt;
            </p>
            &lt;?=form_fieldset_close();?&gt;
            &lt;?=form_close();?&gt;


Messages In This Thread
input->post not working - by El Forum - 04-28-2008, 12:46 PM
input->post not working - by El Forum - 04-28-2008, 02:14 PM
input->post not working - by El Forum - 04-28-2008, 02:37 PM
input->post not working - by El Forum - 04-28-2008, 02:51 PM
input->post not working - by El Forum - 04-29-2008, 11:50 AM
input->post not working - by El Forum - 04-29-2008, 12:14 PM
input->post not working - by El Forum - 04-29-2008, 01:12 PM
input->post not working - by El Forum - 05-15-2008, 02:36 PM
input->post not working - by El Forum - 06-09-2008, 06:53 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.