表单操作按钮未提交

时间:2019-09-27 12:20:34

标签: html forms

我一直在尝试制作一个表单,客户可以在其中指定他们的订单,该表单将发送到我的邮件ID。但是,当我单击“提交”时,它没有运行 mailorder.php 而不是加载 mailorder.php ,而该文件是我为发送其他表单数据而设置的,因此知道为什么可能正在发生? 下面是我正在使用的代码。

<form id="myForm" action="mailorder.php" method="post" class="contact-form">
                <div class="row justify-content-center">
                    <div class="col-lg-6">
                        <input name="fname" placeholder="Enter Employee name" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Employee name'" class="common-input mt-20" required="" type="text">
                    </div>
                    <div class="col-lg-6">
                        <input name="sname" placeholder="Enter shop name" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter shop name'" class="common-input mt-20" required="" type="text">
                    </div>
                    <div class="col-lg-6">
                        <input name="email" placeholder="Enter Shop Owner's Contact Number" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Shop Owner's Contact Number'" class="common-input mt-20" required="" type="number">
                    </div>
                    <div class="col-lg-6">
                        <input name="saddress" placeholder="Enter Shop address" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Shop address'" class="common-input mt-20" required="" type="text">
                    </div><div class="col-lg-10">
                        <p></p>
                        <h3 style="color:#333;">Please fill product details below:</h3>
                    </div>
                    <div class="col-lg-4">
                        <input name="itemone" placeholder="Enter Item 1" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Item 1'" class="common-input mt-20" required="" type="text">
                    </div>
                    <div class="col-lg-4">
                        <input name="colorone" placeholder="Enter Colour" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Colour'" class="common-input mt-20" required="" type="text">
                    </div>
                    <div class="col-lg-4">
                        <input name="qtyone" placeholder="Quantity" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Quantity'" class="common-input mt-20" required="" type="number">
                    </div>
                    <div class="col-lg-10 d-flex justify-content-end">
                    <button class="primary-btn white-bg d-inline-flex align-items-center mt-20"><span class="mr-10">Send Message</span><span class="lnr lnr-arrow-right"></span></button> <br>
                </div>
                <div class="alert-msg"></div>
                </div>
            </form>

1 个答案:

答案 0 :(得分:1)

缺少按钮类型

<form id="myForm" action="mailorder.php" method="post" class="contact-form">
                <div class="row justify-content-center">
                    <div class="col-lg-6">
                        <input name="fname" placeholder="Enter Employee name" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Employee name'" class="common-input mt-20" required="" type="text">
                    </div>
                    <div class="col-lg-6">
                        <input name="sname" placeholder="Enter shop name" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter shop name'" class="common-input mt-20" required="" type="text">
                    </div>
                    <div class="col-lg-6">
                        <input name="email" placeholder="Enter Shop Owner's Contact Number" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Shop Owner's Contact Number'" class="common-input mt-20" required="" type="number">
                    </div>
                    <div class="col-lg-6">
                        <input name="saddress" placeholder="Enter Shop address" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Shop address'" class="common-input mt-20" required="" type="text">
                    </div><div class="col-lg-10">
                        <p></p>
                        <h3 style="color:#333;">Please fill product details below:</h3>
                    </div>
                    <div class="col-lg-4">
                        <input name="itemone" placeholder="Enter Item 1" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Item 1'" class="common-input mt-20" required="" type="text">
                    </div>
                    <div class="col-lg-4">
                        <input name="colorone" placeholder="Enter Colour" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Colour'" class="common-input mt-20" required="" type="text">
                    </div>
                    <div class="col-lg-4">
                        <input name="qtyone" placeholder="Quantity" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Quantity'" class="common-input mt-20" required="" type="number">
                    </div>
                    <div class="col-lg-10 d-flex justify-content-end">
                    <button type="submit" class="primary-btn white-bg d-inline-flex align-items-center mt-20"><span class="mr-10">Send Message</span><span class="lnr lnr-arrow-right"></span></button> <br>
                </div>
                <div class="alert-msg"></div>
                </div>
            </form>