Welcome Guest, Not a member yet? Register   Sign In
problem with form_open
#1

[eluser]henry178[/eluser]
Hi!
I have this easy controller:

Code:
class signup_login extends CI_Controller {
    
    public function index()
    {

        
        $this->load->helper('common');
        $this->load->helper('html');
        $this->load->helper('form');
        $this->load->library('form_validation');
        
        $data['lingua'] = $this->lang->load(DEFAULT_LANGUAGE, NAME_LANGUAGE);
        $data['lingua'] = $this->lang->language;
    
        $required2 = $data['lingua']['required'];
        
        $this->form_validation->set_message('required',$required2);
        
        $this->form_validation->set_rules('name','lang:first_name','required');
        $this->form_validation->set_error_delimiters('<div style="color:red">', '</div>');
        
        
         if ($this->form_validation->run() == FALSE)
          {
             $this->load->view('template1/signup_login');
          }
          else
          {
             //$this->load->view('template1/formsuccess');
          }
    
        
    }
    
    
}

this is the view:

Code:
<h1>Signup</h1>
  &lt;?php echo validation_errors(); ?&gt;
            
    &lt;?php echo form_open('signup_login') ?&gt;
      <label for="name">Username:</label>
       &lt;input type="text" name="username" id="username" value="&lt;?php echo set_value('username');?&gt;"/&gt;
       &lt;?php echo form_error('username'); ?&gt;
      <br/>
            &lt;input type="submit" value="Send"/&gt;
            &lt;/form&gt;


When i click the submit button.. this is the url: www.site.com/?signup_login and loading the default_controller index.....

Why it doesn't work?
#2

[eluser]osci[/eluser]
I believe this is htaccess problem. Can you post your .htaccess?
#3

[eluser]henry178[/eluser]
The problem that I am getting is that form_open is automatically adding a question mark (?) to my url.

in my config.php file:
$config['enable_query_strings'] = TRUE;
#4

[eluser]henry178[/eluser]
[quote author="osci" date="1308517176"]I believe this is htaccess problem. Can you post your .htaccess?[/quote]


this is my code:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
#5

[eluser]osci[/eluser]
Do you want your url to be like example.com?who=me&what=something&where=here
If not disable enable_query_strings. you can always have allow_get_array to TRUE if you need the $_GET array

If that's the case you could remove ? from your rewrite rules
#6

[eluser]henry178[/eluser]
[quote author="osci" date="1308519048"]Do you want your url to be like example.com?who=me&what=something&where=here
If not disable enable_query_strings. you can always have allow_get_array to TRUE if you need the $_GET array

If that's the case you could remove ? from your rewrite rules[/quote]

Ok! Thanks for you suggest Smile




Theme © iAndrew 2016 - Forum software by © MyBB