Problem with form submit |
[eluser]stingray9[/eluser]
For an unkown reason my form don't want to submit.. It just puts it's values into my url.. This is my view: Code: <form method="post" action="admin.php"> And this is my controller: Code: function Admin() And my base_url is set correct with the http://... I've done many forms and never faced this problem. The fact is that when i click on 'save', it put's my values in my url: /admin?kleurtitel=323232&save=Save But nothing happens.. If i put an alert after if ($this->form_validation->run()) { nothing appears, so it doesn't work.. Anyone have an idea what i'm missing here?
[eluser]stingray9[/eluser]
Maybe something in a config file or something, i don't have a clue.. Anyone has an idea?
[eluser]bogdan3l[/eluser]
Hello! Do you use mod_rewrite? If you do please follow this steps: 1. Change $this->load->helper('form', 'url'); to $this->load->helper(array('form', 'url')); 2. Change action="admin.php" to action="<?php echo base_url(); ?>admin/" Than everything will work just fine. If you do not use mod_rewrite I recommend you to read this guide first http://farinspace.com/codeigniter-htaccess-file/ Bye
[eluser]stingray9[/eluser]
[quote author="ci_the_best" date="1297029770"]Hello! Do you use mod_rewrite? If you do please follow this steps: 1. Change $this->load->helper('form', 'url'); to $this->load->helper(array('form', 'url')); 2. Change action="admin.php" to action="<?php echo base_url(); ?>admin/" Than everything will work just fine. If you do not use mod_rewrite I recommend you to read this guide first http://farinspace.com/codeigniter-htaccess-file/ Bye[/quote] Hey, Thanks for your reply. Indeed, i use mod_rewrite. I changed the things you said, but still the same problem. From http://site.assist/admin where my form is, after submitting i stay on the same page, but the url changes to: http://site.assist/admin?kleurtitel=323232&save=Save I really don't understand the problem.. I hope anyone knows a solution.
[eluser]bogdan3l[/eluser]
It is really weird. I get this kind of url http://site.assist/admin?kleurtitel=323232&save=Save only when i change method="post" to method="get".
[eluser]stingray9[/eluser]
[quote author="ci_the_best" date="1297031125"]It is really weird. I get this kind of url http://site.assist/admin?kleurtitel=323232&save=Save only when i change method="post" to method="get".[/quote] Yeah, i think that must me the problem. That's why i wrote <form method="post" action="admin.php"> in stead of form_open() already, but didn't seem to help. Can it be defined in a config file or something maybe?
[eluser]stingray9[/eluser]
Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]bogdan3l[/eluser]
Everything works fine for me with your configuration.
[eluser]stingray9[/eluser]
This is damn strange, i tried to write another form with other validations, but it doesn't work. It must be because of a file somewhere else ![]() |
Welcome Guest, Not a member yet? Register Sign In |