Need Help Please Can Not Send Email From Website |
[eluser]razerone[/eluser]
Hi I am using email set up form my contact form I don't know what to put in my contact views form so people can send text emails with subject etc.. Just stuck on the views form side of things when I ad value it doesn't work not sure what doing wrong contact controller Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); contact views page Code: <form role="form" method="post" acti>
[eluser]Ckirk[/eluser]
Is this all your code or did you leave something out? In your controller neither the index or the send functions are capturing the post data from the form ($this->input->post() ). Check out Form Validation in the codeigniter manual for an example on how to capture your input.
[eluser]razerone[/eluser]
I have another file that has my password and stuff on I have attached that $this->load->library('email'); that has my protocol and that on it. I have placed that in my config folder it is better that way for security. No just trying to get the front end done but hard understanding suitable code. for the inputs.
[eluser]razerone[/eluser]
I got it all working now by reading properly through user guide <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Contactpage extends MX_Controller { function index() { $this->load->view('header'); $this->load->view('contact-us'); $this->load->view('footer'); $this->load->helper('form'); } function messagesent() { $this->load->helper('form'); $this->load->library('email'); $this->email->from($this->input->post('email'), $this->input->post('name')); $this->email->to('demo@demo.com'); $this->email->subject($this->input->post('subject')); $this->email->message($this->input->post('message')); if($this->email->send()) { $this->load->view('header'); $this->load->view('messagesent'); $this->load->view('footer'); } else { show_error($this->email->print_debugger()); } } } <?php echo form_open('/contactpage/messagesent'); ?> <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12 pull-right"> <div class="form-group"> <input name="name" type="text" id="focusedInput" class="form-control " placeholder="Enter Name"> </div> <div class="form-group"> <input name="email" type="text" id="focusedInput" class="form-control" placeholder="Enter Email"> </div> <div class="form-group"> <select name="subject" id="focusedInput" class="form-control" > <option selected="">Choose One:</option> <option>Feedback</option> <option>Suggestion</option> <option>Question</option> <option>Other</option> </select> </div> <div class="form-group"> <textarea name="message" type="text" class="form-control" rows="4" placeholder="Message" name="message"></textarea> </div> <div class="pager"> <button type="submit" class="btn btn-primary">Submit</button> <button type="reset" class="btn btn-danger">Reset</button> </div> </div> <?php echo form_close();?>
|
Welcome Guest, Not a member yet? Register Sign In |