簡體   English   中英

如何使用jQuery步驟匯總表單向導

[英]How to sumbit a form wizard using jQuery steps

我已經安裝了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將表單向導匯總到db:

<?php 
if(isset($_POST['submit'])){
    //save values
}

?>

onFinished方法可用於將表單提交給服務器

onFinished: function (event, currentIndex) {
    var form = $(this);
    // Submit form input
    form.submit();
},

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM