I have one update form in Codeigniter.
I am validating it using form validation helper.My problem is how can i redirect user to same form when form validation fails? I need that update id as well in Url which I am passing.
Here is the code of calling same form
if ($this->form_validation->run() == FALSE) {
$d['v'] = 'products/update';
$this->load->view('template', $d);
return;
}
but it doesn't have that update id which I have passed.
http://www.example.com/products/update/10
Thanks
In your controller:
public function update( $id ){
if ($this->form_validation->run() == FALSE) {
$d['v'] = 'products/update/' . $id;
$this->load->view('template', $d);
return;
}
}
In your View File:
<form action="<?php echo $v; ?>" ..other attributes..> ....form elements....... </form>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.