PHP isset() with multiple parameters

前端 未结 4 1089
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 10:08

I\'m trying to work with AJAX autocompletes and I am having a few problems with getting the two languages to work in synergy.

When I replace all the issets with only

4条回答
  •  再見小時候
    2020-12-08 10:29

    The parameters of isset() should be separated by a comma sign (,) and not a dot sign (.). Your current code concatenates the variables into a single parameter, instead of passing them as separate parameters.

    So the original code evaluates the variables as a unified string value:

    isset($_POST['search_term'] . $_POST['postcode']) // Incorrect
    

    While the correct form evaluates them separately as variables:

    isset($_POST['search_term'], $_POST['postcode']) // Correct
    

提交回复
热议问题