表单未提交点击提交

时间:2018-04-02 04:31:43

标签: forms submit

我有一个简单的表单,尝试提交相同的表单,但是当我单击提交时,按钮上的进度是不变的,表单不会被提交。您可以查看www.factore.in/source/forms/contact/index.php上发生的事情

以下是php页面的代码,请指教:

<?php
    require dirname(__FILE__)."/j-pro/php/csrf.php";
    $new_token = new CSRF("contact");
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Contact form</title>

    <!-- Your META here -->
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0" name="viewport">

    <!-- Stylesheets -->
    <link rel="stylesheet" href="j-pro/css/demo.css">
    <link rel="stylesheet" href="j-pro/css/font-awesome.min.css">
    <link rel="stylesheet" href="j-pro/css/j-pro-modern.css">

    <!-- Scripts -->
    <script src="j-pro/js/jquery.2.2.4.min.js"></script>
    <script src="j-pro/js/jquery.ui.min.js"></script>
    <script src="j-pro/js/jquery.maskedinput.min.js"></script>
    <script src="j-pro/js/jquery.j-pro.js"></script>

</head>
<body class="bg-pic">
    <div class="j-wrapper j-wrapper-400">

        <form action="j-pro/php/action.php" method="post" class="j-pro" id="j-pro" novalidate>

            <div class="j-header">
                <p>Contact form</p>
            </div>
            <!-- end /.header-->

            <div class="j-content">

                <!-- start token -->
                <div class="j-token">
                    <?php echo $new_token->get_token();?>
                </div>
                <!-- end token -->

                <!-- start name -->
                <div class="j-unit">
                    <label class="j-label">Name</label>
                    <div class="j-input">
                        <label class="j-icon-right" for="name">
                            <i class="fa fa-user"></i>
                        </label>
                        <input type="text" placeholder="e.g. John Doe" id="name" name="name">
                    </div>
                </div>
                <!-- end name -->

                <!-- start email -->
                <div class="j-unit">
                    <label class="j-label">Email</label>
                    <div class="j-input">
                        <label class="j-icon-right" for="email">
                            <i class="fa fa-envelope-o"></i>
                        </label>
                        <input type="email" placeholder="email@example.com" id="email" name="email">
                    </div>
                </div>
                <!-- end email -->

                <!-- start phone -->
                <div class="j-unit">
                    <label class="j-label">Phone</label>
                    <div class="j-input">
                        <label class="j-icon-right" for="phone">
                            <i class="fa fa-phone"></i>
                        </label>
                        <input type="text" placeholder="telephone or mobile" id="phone" name="phone">
                    </div>
                </div>
                <!-- end phone -->

                <!-- start textarea -->
                <div class="j-unit">
                    <label class="j-label">Message</label>
                    <div class="j-input">
                        <textarea placeholder="your message..." spellcheck="false" name="message"></textarea>
                    </div>
                </div>
                <!-- end textarea -->

                <!-- start response from server -->
                <div class="j-response"></div>
                <!-- end response from server -->

            </div>
            <!-- end /.content -->

            <div class="j-footer">
                <button type="submit" class="j-primary-btn">Send</button>
            </div>
            <!-- end /.footer -->

        </form>
    </div>

    <script>
        $(document).ready(function(){

            // Phone masking
            $('#phone').mask('999 999-9999', {placeholder:'x'});

            // Validation
            $( "#j-pro" ).justFormsPro({
                rules: {
                    name: {
                        required: true
                    },
                    email: {
                        required: true,
                        email: true
                    },
                    phone: {
                        required: true
                    },
                    message: {
                        required: true
                    }
                },
                messages: {
                    name: {
                        required: "Add your name"
                    },
                    email: {
                        required: "Add your email",
                        email: "Incorrect email format"
                    },
                    phone: {
                        required: "Add your phone"
                    },
                    message: {
                        required: "Enter your message"
                    }
                }
            });
        });
    </script>
</body>
</html>

感谢你 问候 干杯 AG

1 个答案:

答案 0 :(得分:0)

运行您关联的表单已按预期提交,您可以在Chrome开发者工具中查看请求。

失败的原因是由于PHP服务器端代码出错,这就是响应:

PHP Warning: Unexpected character in input: '\' (ASCII=92) state=1 in \\sambaf\sites\factore.in\public_html\source\forms\contact\j-pro\php\action.php on line 71
PHP Warning: Unexpected character in input: '\' (ASCII=92) state=1 in \\sambaf\sites\factore.in\public_html\source\forms\contact\j-pro\php\action.php on line 71
PHP Parse error: syntax error, unexpected T_STRING in \\sambaf\sites\factore.in\public_html\source\forms\contact\j-pro\php\action.php on line 71