Welcome Guest, Not a member yet? Register   Sign In
direct to specific part of page
#1

Hello everyone... i am new to code igniter.

controller code:

public function confirm()
{
$this->load->library('form_validation');
$this->load->model('db_model');
$this->form_validation->set_rules('mem_name', 'Member Name', 'trim');
$this->form_validation->set_rules('mem_no', 'Membership No.', 'trim|required');
$this->form_validation->set_rules('mem_tel', 'Contact No.', 'trim|required');
$this->form_validation->set_rules('mem_email', 'Email', 'trim|valid_email');
//$this->form_validation->set_rules('order_quantity', 'Promo Code', 'trim|required');

if($this->form_validation->run() == false){
$lang = (isset($_GET['lang']))? (($_GET['lang']=='1')?'1':'2') :'1';
$data['title'] = $this->lang->line('wtmemberstore');
$data['main_content'] = 'view-wtmemberstore_order.php#signupform';
$data['lang'] = $lang;
$this->load->view('includes/template', $data);

}else{
$email = $this->input->post('mem_email');
$this->mailto();
redirect(base_url().'wtmemberstore/success');
}

}

when the form validation returns false "wtmemberstore_order" page loads up. But the form is at the bottom of the page. I want the bottom part of the page to be loaded when form validation is false.

Please help me...thanks in advance
Reply
#2

Hi can you post the code for the view please!
Reply
#3

(This post was last modified: 08-27-2015, 10:33 AM by jLinux.)

Is that two ternary operators in one?

Why not do:
PHP Code:
$lang = (@$_GET['lang'] == 2); 

Or
PHP Code:
$lang = (isset($$_GET['lang']) && $$_GET['lang'] == 2); 

Just to simplify it


As far as your initial question, I would use an anchor.. (Ctrl + F Anchor)

Then just have them sent to /the/page/#form_name



More info: http://www.echoecho.com/htmllinks08.htm
Reply
#4

thanks for the reply every one.....i have solved it...had to change the action path in the view...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB