表单数据未发布

时间:2018-07-14 10:10:49

标签: javascript php jquery html forms

我在下面使用了jquery验证插件来保存此表格,但是当我尝试通过php发布数据时,没有任何反应,没有抛出错误,没有任何反应。我做错了什么吗?为简单起见,我从jquery验证中排除了文本和规则。

如果还有其他可行的方法,我也愿意更改我的验证。我正在使用miranda js来获取一些JSON数据,所以我不确定这是否是一团糟。

    <form class="prize-form" id="prize-form" name="registration">
        <h2>Înscrie codul de sub capac/cheiță!</h2>
        <label for="birthday"></label>
        <input class="-white" type="date" max="2000-07-16"name="birthday" id="birthday">
        <label for="phone_number"></label>
        <input class="-white" type="text" name="phone" id="phone">
        <label for="cod"></label>
        <input class="-white" type="text" name="code" id="code">
        <label for="email">Email:</label>
        <input class="-white" type="email" name="email" id="email">
        <label class="checkarea">
            <input class="-white" type="checkbox" name="checkbox[]" id="checkbox1">
            <span class="checkmark"></span>
        </label>
        <label class="checkarea">
            <input type="checkbox" name="checkbox1[]" id="checkbox1">
            <span class="checkmark"></span>
        </label>
        <label class="checkarea">
            <input type="checkbox" name="checkbox2[]" id="checkbox2">
            <span class="checkmark"></span>
        </label>
        <button id="submit" data-popup-open="popup-1" type="submit" class="-yellow submit"></button>
    </form>

验证码

 $(function() {
    $("form[name='registration']").validate({
        submitHandler: function(form) {
        $.post('my.php', $('#prize-form').serialize());
},
    });
});

PHP

$data['phone'] = $_POST['phone'];
$data['code'] = $_POST['code'];
$data['checkbox%5B%5D'] = $_POST['agree'];
$data['checkbox1%5B%5D'] = $_POST['agree'];

0 个答案:

没有答案
相关问题