检查客户是否按下选项标签

时间:2016-06-11 13:37:58

标签: php

我需要检查'option'标签是否设置为$ _POST。

例如,要知道客户端何时按下'select'标签我正在执行此操作:

<?php

if (isset($_POST['select_tag'])) {
    echo 'the client pressed on the select tag';
}

?>

<form method="POST">
    <select name="select_tag">
        <option value="1">1st</option>
        <option value="2">2nd</option>
        <option value="3">3rd</option>
    </select>
</form>

我需要知道客户是否按下值1,2或3,有办法检查吗?

1 个答案:

答案 0 :(得分:0)

$_POST['select_tag']本身,您将从selectbox

中获取所选值
if (isset($_POST['select_tag'])) {
    echo 'the client pressed on the select tag '.$_POST['select_tag'];
}

输出:

the client pressed on the select tag 1.