我尝试在模型窗口中创建表单。但表单操作不起作用。到目前为止,这是我的代码。
HTML代码
<form action="functions/userManagement.php?id="<?php echo $id ?> name='searchdata' id="comment_box" method="get">
<div style="display: none;" aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button aria-hidden="true" data-dismiss="modal" class="close" type="button">x</button>
<h4 id="myModalLabel" class="modal-title">Put the Reason for Deactivate</h4>
</div>
<div class="modal-body">
<textarea rows="4" cols="70" name="comment" form="usrform"></textarea>
</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-default" type="button">Close</button>
<button onclick="form_submit()" class="btn btn-primary" name="add" value="Proceed">Proceed</button>
</div>
</div>
</div>
</div>
</form>
Java脚本代码
<script type="text/javascript">
function form_submit() {
document.getElementById("comment_box").submit();
}
</script>
任何人都可以帮我解决这个问题。
答案 0 :(得分:0)
1st:您的操作属性获取参数值应该在双引号内。
action="functions/userManagement.php?id="<?php echo $id ?>
到
action="functions/userManagement.php?id=<?php echo $id ?>"
第二名:提交的简单更改按钮类型
<button type="submit" class="btn btn-primary" name="add" value="Proceed">Proceed</button>
第3名:您的表单应该在模式中。
<div style="display: none;" aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<form action="functions/userManagement.php?id="<?php echo $id ?> name='searchdata' id="comment_box" method="get">
<div class="modal-header">
<button aria-hidden="true" data-dismiss="modal" class="close" type="button">x</button>
<h4 id="myModalLabel" class="modal-title">Put the Reason for Deactivate</h4>
</div>
<div class="modal-body">
<textarea rows="4" cols="70" name="comment" form="usrform"></textarea>
</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-default" type="button">Close</button>
<button onclick="form_submit()" class="btn btn-primary" name="add" value="Proceed">Proceed</button>
</div>
</form>
</div>
</div>
</div>
注意:简单您提交表单。所以你可以通过按钮类型轻松地提交表格=&#34;提交&#34;
答案 1 :(得分:0)
使用此
onclick="javascript:form_submit()"
使用此
action="<?php echo htmlentities('functions/userManagement.php?id= echo $id');?>"
希望它对你有所帮助。