php - CodeIgniter, Smarty and Form Helper. Wrong Link on Submit -


i have al litte problem using codeigniter form helper , smarty.

i used (https://github.com/ellislab/codeigniter/wiki/form-helper-with-smarty) form helper function.

now have adduser() function in controller

    public function adduser(){         $this->load->helper('form');          $this->form_validation->set_rules('username', 'benutzername', 'trim|required|min_length[4]|xss_clean');         $this->form_validation->set_rules('email', 'email', 'trim|required|valid_email');         $this->form_validation->set_rules('password', 'passwort', 'trim|required|min_length[4]|max_length[32]');         $this->form_validation->set_rules('con_password', 'passwort bestätigen', 'trim|required|matches[password]');          if($this->form_validation->run() == false){             echo "error! user can not create";         }else{             $this->user_model->add_user();             echo "done!";         }         $this->smarty->display($this->tpl);     } 

and following .tpl used

    {form url='pageadmin/adduser'} <p>     <label for="username">user name:</label>     <input type="text" id="username" name="user_name" /> </p> <p>     <label for="email_address">your email:</label>     <input type="text" id="email" name="email_address" /> </p> <p>     <label for="password">password:</label>     <input type="password" id="password" name="password" /> </p> <p>     <label for="con_password">confirm password:</label>     <input type="password" id="con_password" name="con_password" /> </p> <p>     <input type="submit" value="submit" /> </p> {form} 

but now, when try this. have 2 problems. first is, message "error! user can not create" time showed when called function adduser(). second problem is, url, generating form submit, "http://dev.url.de/admin/adduser/dev.url.de/pageadmin/adduser".

thank , sorry bad english...

obviously form failing you're not returning why it's failing. change code below, tell find out isn't passing validation:

if($this->form_validation->run() == false){             echo validation_errors();         }else{ 

the validation errors tell rule(s) is/are problem, can continue troubleshoot there.

as url it's because of relative url's, don't use smarty not sure how use base_url() following "might" work

{form url=base_url().'pageadmin/adduser'} 

if doesn't work should:

{form url='../pageadmin/adduser'} 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -