I can't able submit my form in codeiginiter

form code:

            <form method="post" action="<?php echo site_url('AddController/submit_data'); ?>" name="data_register">
                <label for="Name">Enter you name</label>
                <input type="text" class="form-control" name="username" required >
                <br>
                <label for="Email">Enter you Email</label>
                <input type="email" class="form-control" name="email" required>
                <br>
                <label for="Sex">Select Sex</label><br>
                <input type="radio" name="sex" checked value="Male" required > Male &nbsp;
                <input required type="radio" name="sex" value="Female" > Female
                <br><br>
                <label for="Email">Address</label>
                <textarea name="address" class="form-control" rows="6" required ></textarea>
                <br><br>
                <button type="submit" class="btn btn-primary pull-right">Submit</button>
                <br><br>
            </form>

controller:

class Addcontroller extends CI_Controller
{

    public function __construct()
    {
        parent :: __construct();
        $this->load->helper('url');
    }

    public function index()
    {
       // $this->load->view('add');

        $this->load->view('add');
    }


    public  function  submit_data()
    {
        print_r($_POST);die();
        $data = array('username'                   => $this->input->post('username'),
            'email'                      => $this->input->post('email'),
            'sex'                        => $this->input->post('sex'),
            'address'                    => $this->input->post('address'),
            'created_date'               => date("m/d/y h:i:s"),
            'status'                     => 'Y');


    }

}

please reply me any one what is the reason i can’t submit my form

contoller page through 404 error

this is my url http://localhost/project/codeigniter/index.php/AddController/submit_data

When you view the source of your form as it is rendered in the browser, what is appearing in the form action parameter, i.e. what is the value of the variable that you echo?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.