我已经安装了 jQuery 步骤,并且想要使用步骤向导制作表单。 问题是当“完成”按钮出现时如何使用 PHP 提交表单。 除了最后一次提交的处理之外,下面的所有代码都有效。
我的表单示例代码:
<form method="POST" action="#" role="form">
<div id="wizard">
<h2>Info</h2>
<section>
<div class="form-group">
<label for="text">Email address:</label>
<input type="text" class="form-control" id="text">
</div>
</section>
<h2>Second Step</h2>
<section>
//form stuff
</section>
<h2>Third Step</h2>
<section>
//form stuff
</section>
<h2>Forth Step</h2>
<section>
form stuff
</section>
</div>
</form>
调用 jQuery 步骤的脚本:
<script>
$(function ()
{
$("#wizard").steps({
headerTag: "h2",
bodyTag: "section",
transitionEffect: "slideLeft",
stepsOrientation: "vertical"
});
});
</script>
最后我想使用 PHP 将表单向导提交到数据库:
<?php
if(isset($_POST['submit'])){
//save values
}
?>
最佳答案
onFinished
方法可用于将表单提交到服务器
onFinished: function (event, currentIndex) {
var form = $(this);
// Submit form input
form.submit();
},
关于jquery - 如何使用 jQuery 步骤提交表单向导,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32634493/