- /* we want the default case to be first here,
- so that if a valid value isn't specified,
- all three arrays will be searched. */
- default:
- case SQ_INORDER: // check session, post, get
- case SQ_SESSION:
- if( isset($_SESSION[$name]) ) {
- $value = $_SESSION[$name];
- $result = TRUE;
- break;
- } elseif ( $search == SQ_SESSION ) {
- break;
- }
- case SQ_FORM: // check post, get
- case SQ_POST:
- if( isset($_POST[$name]) ) {
- $value = $_POST[$name];
- $result = TRUE;
- break;
- } elseif ( $search == SQ_POST ) {
- break;
- }
- case SQ_GET:
- if ( isset($_GET[$name]) ) {
- $value = $_GET[$name];
- $result = TRUE;
+ default:
+ // The default needs to be first here so SQ_INORDER will be used if
+ // $search isn't a valid constant.
+ case SQ_INORDER:
+ // Search $_SESSION, then $_POST, and then $_GET. Stop on the first
+ // match.
+ case SQ_SESSION:
+ if (isset($_SESSION[$name])) {
+ // If a match is found, set the specified variable to the found
+ // value, indicate a match, and stop the search.
+ $value = $_SESSION[$name];
+ $result = TRUE;
+ break;
+ } elseif ($search == SQ_SESSION) {
+ // Only stop the search if SQ_SESSION is set. SQ_INORDER will
+ // continue with the next clause.
+ break;
+ }
+ case SQ_FORM:
+ // Search $_POST and then $_GET. Stop on the first match.
+ case SQ_POST:
+ if (isset($_POST[$name])) {
+ // If a match is found, set the specified variable to the found
+ // value, indicate a match, and stop the search.
+ $value = $_POST[$name];
+ $result = TRUE;
+ break;
+ } elseif ($search == SQ_POST) {
+ // Only stop the search if SQ_POST is set. SQ_INORDER and
+ // SQ_FORM will continue with the next clause.
+ break;
+ }
+ case SQ_GET:
+ if (isset($_GET[$name])) {
+ // If a match is found, set the specified variable to the found
+ // value, indicate a match, and stop the search.
+ $value = $_GET[$name];
+ $result = TRUE;
+ break;
+ }
+ // Stop the search regardless of if SQ_INORDER, SQ_FORM, or SQ_GET
+ // is set. All three of them ends here.