PHP isset无法在html按钮

时间:2016-01-07 08:03:14

标签: php html

<form action="service.php" method="POST">
            <fieldset>
                <input type="button" name="getMa" onclick="window.open('service.php')"value="MA anzeigen"/>
                <input type="text" size="5" maxlength="5" name="MA_ID" value=""/><br><br>
            </fieldset>

service.php:

if(isset($_POST['getMa']))
    {
        echo "getMa gedrückt";
    }

我只是想知道哪些按钮被按下了,我做错了什么?任何帮助表示赞赏,我对这些东西都是新手,大家好 问候 ISMIR

1 个答案:

答案 0 :(得分:3)

删除onclick="window.open('service.php')"action属性将提交表单。您基本上是直接打开一个窗口,因此它没有关于POST参数

的任何信息

然后改变

 type="button"

 type="submit"