表单提交按钮不起作用?

时间:2016-05-21 10:02:27

标签: php html forms button input

之前我遇到过这个问题,所以我通常总是使用“AB → C”但是我希望将bin图像作为按钮而不是文本(显然是创建删除按钮)。为了让我这样做,我需要使用按钮标记,但是PHP代码不适合它。

HTML:

<input type='submit' ... >

PHP:

<form action='#' method='POST'>
  <button type='submit' name='form-wallpostdelete'>Delete</button>
</form>

非常简单,当我使用“input type ='submit'name ='form-wallpostdelete'value ='Delete'&gt;”时它工作正常,并且消息被回显,但是当我使用按钮时,页面只是刷新。

1 个答案:

答案 0 :(得分:1)

Use isset() method for checking  
<form action='#' method='POST'>
      <button type='submit' name='form-wallpostdelete'>Delete</button>
    </form>
    <?php 
    $delete_post = @$_POST['form-wallpostdelete']; //Form variable

    if(isset($delete_post)) {
        echo "Deleted";
    }
    ?>
相关问题