[eluser]Unknown[/eluser]
Hi people,
Let's say I have a method at Controller named
Code:
book($chapter,$page);
where $chapter and $page must be integer. To access the method, the URI will look like
For example,
If user try to access the URI without passing all parameter, or wrong parameter, like
or
I can do some if else statements to handle, like
Code:
if(!empty($page)){
//process
}else{
//redirect
}
My question is, is there any best practice to handle those invalid parameters passed by user?
My ultimate goal is to redirect to the main page whenever there is an invalid parameter? How can I achieve this?
Thank you for reading!
I'm sorry for post in the wrong place, please help me to move this to Code! section, thank you so much!