CI Form Validation tutorial doesn't work |
[eluser]solkatten[/eluser]
I am following the tutorial: http://ellislab.com/codeigniter/user-gui...ation.html but I get the error 404 when clicking the Submit button. I can't figure out what's wrong. My controller: Code: <?php My view for the form: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> My view for the success message: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> When I change Code: if ($this->form_validation->run() == FALSE) Code: if ($this->form_validation->run() == TRUE) My config: Code: $config['base_url'] = "http://webplace/susanne/codeigniter/"; Code: $route['default_controller'] = "form";
[eluser]LuckyFella73[/eluser]
I can't see errors that are defenitely responsible for you problem. Just 2 questions: 1. Is there a specific reason why your form closing tag is commented out? 2. Why did you changed the config file from Code: $config['index_page'] = "index.php"; to Code: $config['index_page'] = "form.php"; Maybe that is why your anchor doesn't work after submitting the form. $config['index_page'] is the index.php in your root path and not the first page/ controller you want to be shown. That is defined by "default_controller" in routes.php -> you allready edited that.
[eluser]solkatten[/eluser]
[quote author="LuckyFella73" date="1267469175"] 1. Is there a specific reason why your form closing tag is commented out? [/quote] There is no start tag and the form_open() contains closing tag according to http://ellislab.com/codeigniter/user-gui...elper.html. The error existed before I commented the closing tag. [quote author="LuckyFella73" date="1267469175"] 2. Why did you changed the config file from Code: $config['index_page'] = "index.php"; to Code: $config['index_page'] = "form.php"; Maybe that is why your anchor doesn't work after submitting the form. $config['index_page'] is the index.php in your root path and not the first page/ controller you want to be shown. That is defined by "default_controller" in routes.php -> you allready edited that. [/quote] When I did the blog tutorial I changed it and it worked so I just figured it was one of those places wich need changeing. But your explanation makes sence. Right now I have: Parse error: syntax error, unexpected ';' in /var/www/susanne/codeigniter/system/application/controllers/form.php on line 14 A file I haven't changed... :-S
[eluser]LuckyFella73[/eluser]
In that file (your form controller): Quote:codeigniter/system/application/controllers/form.php you have a "(" (first character) which makes no sense: Code: ($this->load->view('myform'); Try to remove and test again. And be sure that your application/config/config.php file contains: Code: $config['index_page'] = "index.php"; in case you didn't rename "index.php" in your root folder ( .../www/susanne/codeigniter/index.php ) Hope that will solve your problem hej hej
[eluser]solkatten[/eluser]
[quote author="LuckyFella73" date="1267472990"] you have a "(" (first character) which makes no sense: Code: ($this->load->view('myform'); I think it is called temporary programming blindness :lol: I have changed the config file AND NOW IT IS WORKING! THANK YOU!
[eluser]LuckyFella73[/eluser]
We all are not save of typos and will never be ... Nice to hear that your form is working now ![]() |
Welcome Guest, Not a member yet? Register Sign In |