![]() |
Codeigniter contact form - newbie - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Codeigniter contact form - newbie (/showthread.php?tid=56999) |
Codeigniter contact form - newbie - El Forum - 02-05-2013 [eluser]runtaylor[/eluser] I'm brand new to code igniter and learning it as I'm working on this website Basically I'm trying to get a contact form going but it's proving to be VERY difficult for some reason I have the form displaying on my site and everything but when I submit it it goes to a blank page and doesn't send the email or go to success_view like it should the page is: http://www.vancouverticket.com/contact then it goes to contact/emailsender instead of running the email sender function I'm sure I'm missing something silly but please help me out I got the original code from: https://github.com/furiston/codeigniter-contact-form/pull/1/files and modified the code a bit here is the controller: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); and the view Code: <head> Codeigniter contact form - newbie - El Forum - 02-05-2013 [eluser]CroNiX[/eluser] When I went to the contact page and clicked submit without filling anything out, It went to /contact/emailSender like your form tells it to submit to and loaded the contact_view with nothing else (no header/footer etc) which is exactly what your code is telling it to do if the validation fails. From what I can tell, it's working as coded. It fails validation so it only loads the form with nothing else like the code tells it to. You aren't outputting any validation errors on the form so the user would have no idea it failed or why. Codeigniter contact form - newbie - El Forum - 02-05-2013 [eluser]CroNiX[/eluser] I'd try 2 things. In your form, add the validation error output. Code: echo validation_errors(); In your controller for validation, when it fails, try just sending it back to the index method which displays the whole form instead of loading that partial view: Code: $this->index(); Code: $this->load->view('contact_view'); Codeigniter contact form - newbie - El Forum - 02-05-2013 [eluser]runtaylor[/eluser] I tried adding the echo in but it still just goes to http://www.vancouverticket.com/contact/emailsender which is a blank page instead of running the function. I'm not getting any errors back or anything. I tried putting the <?php echo validation_errors(); ?> line just above the form close and when that didn't work I tried it in the message box hoping it may echo it back in there. Why would it be going to contact/emailsender instead of running the process? I'm at a loss. Where should I put the validation_errors? It didn't seem to change anything when I tried EDIT I realized I missed your original post If it's working as it should then I am seriously confused because it seems to be going to the emailsender page or whatever when it should just be running that function and going to success_view as I understood the code to be telling it to do so Codeigniter contact form - newbie - El Forum - 02-06-2013 [eluser]runtaylor[/eluser] Still stuck on this if anyone can help |