Welcome Guest, Not a member yet? Register   Sign In
Making form submission generate email and update database.
#1

[eluser]Stompfrog[/eluser]
Hi all,

I am new to code igniter and am working through my first project with it now.

I am finding it brilliant, so much faster than old fashioned PHP :0)

I have only run into one problem so far which is this...

I want to submit a form which sends all its contents to the database and then generates me an email with just some of the info.

I can get each part to work on its own but i can't pull them together.

In my submit.php controller I have a submit_content() function which has the code to generate the email and to update the db. If i comment either half of this code out the other half works fine but if i do them both together the email never turns up. Should I put these two different parts in seperate functions and redirect from one to the other or should I leave it all in one function? If so, why won't it work?

Code:
function submit_content(){
    
    // Email stuff
    $this->load->library('email');
    $this->load->helper('email');
    $message = "email message content";
    $this->email->to('[email protected]');
    $this->email->subject($_POST['email subject']);
    $this->email->message($message);
    $this->email->send();

    // db stuff
    $this->db->insert('db_name', $_POST);    
        
}

Thanks in advance,

Stompfrog


Messages In This Thread
Making form submission generate email and update database. - by El Forum - 06-30-2008, 11:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB