试图确定哪种形式在PHP提交

时间:2018-12-01 00:33:16

标签: php html

我正在尝试在同一页面中制作几种表单,但是我遇到了一个问题,就是php代码没有响应提交动作

    <form id="DeleteEmployeeModal" name="DeleteEmployeeModal" method="post">>
                <div class="modal-header">                      
                    <h4 class="modal-title">Delete Employee</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                </div>
                <div class="modal-body">            
                    <div class="form-group">
                        <label>Name</label>
                        <select  class="form-group" required>

            </select>
                    </div>

                </div>
                <div class="modal-footer">
                    <input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">

                </div>
                <input type="submit"  name="formAddEmplyee" class="btn btn-danger" value="Delete">
            </form>
<?php if(isset($_POST["DeleteEmployeeModal"])){

`echo "What is happpopoihsdafopishdfpoishdfpoaishdfpoiasdhfpoiashdfpoih";`}`?>`

1 个答案:

答案 0 :(得分:1)

一种解决方法是在每个表单中添加一个隐藏的表单名称输入:

<input type="hidden" name="formname" value="DeleteEmployeeModal" />

然后在您的PHP中,您只需检查$_POST['formname']的值即可查看提交的表单。