我有一个要求输入的外部类,并将输入返回到原始页面。我有相同的设置在其他模块上工作,但它不适用于这个。我已经尝试重命名提交名称并在表单中添加操作页面,但没有运气。
<!-- BanPlayer -->
<div class="modal fade" id="BanPlayerModule" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form method="POST">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title, text-danger" id="myModalLabel">Ban <?php echo $Username; ?></h4>
</div>
<div class="modal-body">
<table style='padding:0px; margin:0px;' class='table table-condensed'>
<thead>
<th>Player</th><th>Length</th><th>Reason</th>
</thead>
<tbody>
<tr><td><?php echo $Username; ?></td><td><input name="BanTime" placeholder="10d4h30s" type="text"></td><td><input type="text" name="BanReason" placeholder="Was impersonating an admin"></td></tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="submit" name="banPlayer" class="btn btn-danger" data-dismiss="modal">Ban</button>
</div>
</form>
</div>
</div>
</div>
<!-- End BanPlayer Modal -->
其他班级
<?php
//ban player
if(isset($_POST['banPlayer'])) {
echo 'yay';
?>
答案 0 :(得分:2)
你的PHP代码写在哪个页面?假设它是在test.php上,那么在html中用
替换表单<form method="POST" action="test.php">
如果它在同一页面,则写入
<form method="POST" action="#">