取一个元名的值

时间:2016-10-24 12:10:57

标签: javascript php jquery mysql

我有一个<span>的表单,它作为一个滑块,可以提供一些值。此表单已经通过电子邮件发送正确,但我现在需要将数据保存在数据库中,但无法保存此<span>的值,这在代码中是错误的吗?

形式:

<form class="form-carro" method="POST">
    <div class="form">

        <h4>Valor do consórcio: <span class="slider-value quote-form-element" data-name="Valor" data-slider-id="consorcio-auto">R$ <span></span></span>
        </h4>
        <div class="slider" data-slider-min="20000" data-slider-max="100000" data-slider-start="23192" data-slider-step="1000" data-slider-id="consorcio-auto"></div>

        <h4>Seus dados:</h4>
        <input type="hidden" name="Consórcio" value="Automóvel" />
        <input type="text" name="Nome" placeholder="Nome..." class="quote-form-element" />
        <input type="text" name="Cidade" placeholder="Cidade/UF..." class="quote-form-element quote-form-client-email last" />
        <input type="text" name="Telefone" placeholder="Telefone..." class="quote-form-element telefone" />
        <input type="text" name="Email" placeholder="E-mail..." class="quote-form-element quote-form-client-email last contact_email" />

        <button class="button button-navy-blue send-quote" type="submit" id="enviar">Simular meu consórcio <i class="fa fa-paper-plane-o"></i></button>

        <div class="quote-form-thanks">

            <div class="quote-form-thanks-content">

                Obrigado pelo seu interesse, retornaremos em breve ;).
                <span class="quote-form-thanks-close">Fechar</span>

            </div>

        </div>

    </div>

</form>

Envia BD php

<?php
$con = mysql_connect("localhost", "******", "########");
if (!$con) {
    die('Could not connect: ' . mysql_error());
}

mysql_select_db("joinmene_leads", $con);

$valor = $_POST[Valor];
$nome = $_POST[Nome];
$cidade = $_POST[Cidade];
$telefone = $_POST[Telefone];
$email = $_POST[Email];


$sql = "INSERT INTO automovel (valor, nome, cidade, telefone, email )
        VALUES
        ('$valor','$nome','$cidade','$telefone','$email')";


if (!mysql_query($sql, $con))
    mysql_close($con)
?>

这是发送电子邮件的脚本

$.martanianConfigureValueSlider = function() {
    $("#quote-popup .quote-form .slider, section.quote-forms .slider").each(function() {
        var a = $(this).data("slider-min"),
            b = $(this).data("slider-max"),
            c = $(this).data("slider-start"),
            d = $(this).data("slider-step"),
            e = $(this).data("slider-id");
        $(this).noUiSlider({
            start: c,
            step: d,
            range: {
                min: a,
                max: b
            }
        }), $(this).Link("lower").to($('.slider-value[data-slider-id="' + e + '"] span'), null, wNumb({
            thousand: ".",
            decimals: "0"
        }))
    })
}, $(".send-quote").click(function() {
    var a = $(this).parent(),
        b = a.parent().parent(),
        d = (b.data("quote-form-for"), {}),
        f = "",
        g = "",
        h = "",
        i = "",
        j = !1;
    a.find(".quote-form-element").each(function(a) {
        f = $(this).attr("name"), "undefined" != typeof f && f !== !1 || (f = $(this).data("name")), $(this).hasClass("checkbox") ? g = "yes" == $(this).data("checked") ? $(this).children(".checkbox-values").children(".checkbox-value-checked").text() : $(this).children(".checkbox-values").children(".checkbox-value-unchecked").text() : (g = $(this).is("input") || $(this).is("select") ? $(this).val() : $(this).text(), $(this).is("input") && "" == g || $(this).is("select") && "-" == g ? (j = !0, $(this).addClass("error")) : $(this).removeClass("error")), $(this).hasClass("quote-form-client-name") && (h = $(this).val()), $(this).hasClass("quote-form-client-email") && (i = $(this).val()), d[a] = {
            name: f,
            value: g
        }, a++
    }), 0 == j && $.ajax({
        url: "_assets/submit.php",
        data: {
            send: "quote-form",
            values: d,
            clientName: h,
            clientEmail: i
        },
        type: "post",
        success: function(b) {
            a.children(".quote-form-thanks").fadeIn(300)
        }
    })
})

0 个答案:

没有答案