php - CodeIgniter controller method not responding

464

I have a codeigniter application that is effectively just a one-page form that takes in info and sends an e-mail. I created a method that is intended to handle form submission and send the e-mail called "submit", but for some reason this method appears not to do anything at all.

Here's my controller code:

class Main extends CI_Controller {

public function __construct() {
    parent::__construct();
}

public function index($page = "home") {
    // Loading the form view.
    $this->load->view($page);
}

// This is the method that doesn't do anything.
public function submit() {

    // I would be processing post data from the form here, 
    // but right now I'm just trying to load 
    // a view in this method to see if it's working
    $this->load->view("form_submit");
}

My view is using the CodeIgniter form_open function to create the form, and looks as follows:

echo form_open("main/submit/");

This, to my understanding, is how one is supposed to use the form_open function to provide an action to the form.

The form opening tag looks like this when the view is accesssed.

<form action="http://localhost:81/project1/main/submit" method="post" accept-charset="utf-8">

The action and method in the form tag appears to be correctly set, but when clicking on submit on the form the home view just refreshes. Additionally, if I try to directly navigate to "home/submit/" it just loads the home view again. I'm starting to go a little crazy on this and I'm sure I'm missing something really simple.

People are also looking for solutions to the problem: php - how do i add an autocompletion in my IDE to use Zend helper

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.