Problem with Form Validation and Htaccess file - 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: Problem with Form Validation and Htaccess file (/showthread.php?tid=52026) |
Problem with Form Validation and Htaccess file - El Forum - 05-27-2012 [eluser]DavidHopkins[/eluser] Hello all, I am trying to make a simple log in feature that works fine when i dont make use of a htaccess file in order to remove the index.php part of a url, but when i go into my config and remove the index.php from the following line my form validation always returns false. Code: $config['index_page'] = 'index.php'; My code looks like this Code: public function ProcessLogin() { Code: <div id="LoginContainer"> this is my htaccess file Code: <IfModule mod_rewrite.c> Im not sure why it dosent work when trying to remove the index.php any help would be great ! Dave Problem with Form Validation and Htaccess file - El Forum - 05-27-2012 [eluser]InsiteFX[/eluser] You do not need these anymore, they were for the old versions of CodeIgniter! Code: #Removes access to the system folder by users. CodeIgniter now has .htaccess files in all the directories to protect them. I would also autoload the url_help in ./application/config/autoload.php Being as it is almost always used through out the application. Also you are not giving a name to your submit input! Problem with Form Validation and Htaccess file - El Forum - 05-27-2012 [eluser]Aken[/eluser] Probably unrelated, but you spelled "xss_clean" wrong in your rules. Also, put the actual rules before the sanitize functions (IE: "required|trim|xss_clean"). .htaccess shouldn't affect the way your form_validation works, unless your .htaccess file is manipulating post data or URL redirects or something of that nature. Get everything working without .htaccess first, then go from there. Problem with Form Validation and Htaccess file - El Forum - 05-28-2012 [eluser]DavidHopkins[/eluser] Thanks for your replies all. I have managed to get this working without the use of a htaccess file, however as soon as i change Code: $config['index_page'] = 'index.php'; Code: $config['index_page'] = ''; FOr some reason i get errors relating to no such variables cid, email and pass which are the names of my form elements Quote:A PHP Error was encountered Thats one error, but i dont get that when i have index.php in my config file. Its really odd and starting to bother me a little bit Here is my htaccess file Code: <IfModule mod_rewrite.c> Thanks Dave Problem with Form Validation and Htaccess file - El Forum - 05-28-2012 [eluser]InsiteFX[/eluser] Dave, what os are you running? Problem with Form Validation and Htaccess file - El Forum - 05-28-2012 [eluser]DavidHopkins[/eluser] Linux, Ubuntu Edit, I know htaccess files are working because i haev a wordpress install using a htacess file for clean links also Problem with Form Validation and Htaccess file - El Forum - 05-28-2012 [eluser]InsiteFX[/eluser] No, that's fine I was only asking because on windows it doe's not use the .c it uses .so Did you try using the full php tags on the form_open? Code: <?php echo form_open('login/ProcessLogin'); ?> This is strange because I run Windows 7 Pro and I can remove index.php and it works fine with forms. Problem with Form Validation and Htaccess file - El Forum - 05-28-2012 [eluser]DavidHopkins[/eluser] Yep just tried that and its the same result. Its really odd im not sure whys its doing it because i copied the code from a different project i had been working on. =[ Edit, itd odd because i can navigate to /login/testfunction which just echos a string just fine. It just seems that for some reason the post is losing its variables. Problem with Form Validation and Htaccess file - El Forum - 05-28-2012 [eluser]InsiteFX[/eluser] Try this Code: public function ProcessLogin() { Problem with Form Validation and Htaccess file - El Forum - 05-28-2012 [eluser]DavidHopkins[/eluser] Nope comes back array(0) { } Reading on the Internet alot of people seem to have troubles with post data and the htaccess file but no one seems to have provided an answer. I know it can be done thou, because i have had it working on a different project some time ago now. Dave |