php - Why does the form_open not posting anything? -


i new codeigniter , php , trying make change password script. change password function in controller called scrips.can't quite understand why it's not posting @ all.

this controller :

public function change_password() {        $this->page_handler->member_page();     $this->load->database();     $this->form_validation->set_rules('old_pass','old password','required');     $this->form_validation->set_rules('new_pw','new password','required');     $this->form_validation->set_rules('conf_pw','confirm password','required|matches[new_pw]');      if($this->form_validation->run() !=true) {         $sql=$this->db->select("*")->from("members")->where("username", $this->session->userdata("username"))->get();          foreach ($sql->result() $my_info) {             $db_password=$my_info->password;             $db_id -$my_info->id;         }          if(md5($this->input->post("old_pass"))== $db_password) {                 $fixed_pw = md5(mysql_real_escape_string($this->input->post("new_pw")));             $update=$this->db->query("update 'members' set 'password' = '$fixed_pw' 'id'='$db_id'") or die(mysql_error());              $this->session->set_flashdata("notification","password has been updated!");             redirect('home_view');         } else {             echo "a problem has occurred,please try again.";             $this->load_view("home_view");             }         }         } 

and view:

<?php echo form_open('scripts/change_password') ?>       <input placeholder="old password"             id="old_pass"             value="<?php echo set_value(md5('old_pass')); ?> "            name="old_pass"             class="w3-input w3-border"            type="password" >      <input placeholder="new password"            id="new_pw"             value="<?php echo set_value('new_pw'); ?>"             name="new_pw"             class="w3-input w3-border"             type="password">      <input placeholder="confirm password"             id="conf_pw"             value="<?php echo set_value('conf_pw'); ?>"             name="conf_pw"            class="w3-input w3-border"             type="password">      <input class="w3-margin-top w3-btn w3-hover-white"             type="submit"             value="change password "            style="width:100%">change password</button>  <?php form_close(); ?> 

it looks problem within change_password() method, checking validator not validating:

if($this->form_validation->run() !=true) {     ... } 

change to:

if($this->form_validation->run() == true) {    ... } 

and should work.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -