I have a controller where I have data being sent either via GET or POST either one at anytime but not both, because of this i get error
Message: Undefined index: userid
this is either due to POST or GET depends on what one is not found.
How can i add a statement so that if no POST is found look for GET and not have the error displayed ?
MY CODE
public function index()
{
$this->session->userdata('user_id');
$userID = $this->session->userdata('userid');
// var_dump($userID);
$this->session->set_userdata('user_id', $_POST['userid']);
$this->session->set_userdata('user_id', $_GET['userid']);
$data['tests'] = simplexml_load_file("tests/tests.xml");
$this->load->view('selecttest',$data);
}
}