У меня есть URL, в котором есть переменные get, такие как:
domain.com/recover?email=my@email.com&token=abc123
внутри контроллера восстановления. Я загружаю форму с POST
методом
, поэтому, когда я отправляю формуя снова загружаю контроллер восстановления, но мои GET
переменные исчезают и возвращаются к
domain.com/recover
, так как я могу убедиться, что переменные GET
сохраняются в URL после отправки формы?
HTML:
<?php echo form_open('recover'); ?>
<label for="password1" class="fl" style="width:160px;">Your new Password</label>
<input type="text" value="" id="password1" name="password1" style="width:308px;margin-top:0;margin-left:10px;" />
<label for="password2" class="fl" style="width:160px;">Retype your new Password</label>
<input type="text" value="" id="password2" name="password2" style="width:308px;margin-top:0;margin-left:10px;" />
<input type="submit" value="Recover password" class="button_ui" name="submit" />
<?php echo form_close(); ?>
Контроллер:
$data = array(
'errors' => '',
'show_password_form' => false
);
$get_email = $this->input->get("email") ? trim($this->input->get("email")) : "";
$get_token = $this->input->get("token") ? trim($this->input->get("token")) : "";
if ($get_email != "" && $get_token != ""){
$this->load->model("recover_model");
$data["show_password_form"] = true;
//check new passwords and update
$submit = $this->input->post("submit_change") ? trim($this->input->post("submit_change")) : "";
if ($submit){
$password1 = $this->input->post("password1") ? trim($this->input->post("password1")) : "";
$password2 = $this->input->post("password2") ? trim($this->input->post("password2")) : "";
//if password1 is valid
if ($this->recover_model->valid_password($password1)){
//if password2 is valid
if ($this->recover_model->valid_password($password2)){
//if both are equal
if ($password1 == $password2){
//update password
}else{
$data["errors"] = 'Your passwords do not match.';
}
}else{
$data["errors"] = 'Your password must be at least 6 characters.';
}
}else{
$data["errors"] = 'Your password must be at least 6 characters.';
}
}
}
$this->load->view("account/recover/recover", $data);