Welcome Guest, Not a member yet? Register   Sign In
Form to email: passing success / fail message back to view - howto?
#1

[eluser]stef25[/eluser]
im making a simple microsite where people fill in a form to recommend company x to their friends. i have one view (index.php) and one controller (mailer.php). the form submits to the page it's on. the view after the submission should be exactly the same, apart from one little <p>success or fail message</p>.

Im a bit stuck as to how i can get this message back to the view. I read alot about the use of this->load->vars, but how do i get this to appear in my view? $feedback doesnt exist unless the message sending is success or fail, so when i first arrive at index.php i get an error " Undefined variable: feedback", referring to my echo $feedback.

anyone?


Code:
//send mail + success / fail message            
            if (!$this->email->send()) {
                $feedback = array(
                'message' => 'Sorry, message could not be sent'
                );    
                $this->load->vars($feedback);
            }            
            else {
                $feedback = array(
                'message' => 'Message sent!'
                );    
                $this->load->vars($feedback);
            }


Messages In This Thread
Form to email: passing success / fail message back to view - howto? - by El Forum - 03-05-2008, 10:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB