如何修复“单选按钮值未保存在数据库中”

时间:2019-06-06 17:31:19

标签: php html mysqli

我有12个单选按钮。当我单击提交时,POST方法的变量为空,我试图使用get方法,但是它不起作用。

<div class="tab-pane" id="q2">
    <h4 class="info-text"> يرحب بالمناقشة ويتقبل وجهة النظر الاخرى من الطلبة</h4>
    <div class="row">

        <div class="col-sm-10 col-sm-offset-1">
            <div class="col-sm-4">
                <div class="choice" data-toggle="question2">
                    <input type="radio" class="form-control" name="qqq2" value="1">
                    <div class="icon">
                        <i class="fa fa-thumbs-o-up"></i>
                    </div>
                    <h4>نعم</h4>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="choice" data-toggle="question2">
                    <input type="radio" name="qqq2" class="form-control" value="2">
                    <div class="icon">
                        <i class="fa fa-hand-paper-o"></i>
                    </div>
                    <h4>نوعاً ما</h4>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="choice" data-toggle="question2">
                    <input type="radio" name="qqq2" class="form-control" value="3">
                    <div class="icon">
                        <i class="fa fa-thumbs-o-down"></i>
                    </div>
                    <h4>لا</h4>enter code here
                </div>

            </div>
        </div>
    </div>
</div>

这是php的代码

if (isset($_POST['finish'])) {
    $barcode = $_POST['barcode'];
    $q1 = $_POST['question'];
    $q2 = $_POST['qqq2'];
    $q3 = $_POST['qqq3'];
    $q4 = $_POST['qqq4'];
    $q5 = $_POST['qqq5'];
    $q6 = $_POST['qqq6'];
    $q7 = $_POST['qqq7'];
    $q8 = $_POST['qqq8'];
    $q9 = $_POST['qqq9'];
    $q10 = $_POST['qqq10'];
    $q11 = $_POST['qqq11'];
    $q12 = $_POST['qqq12'];

    echo $inSql = "INSERT INTO `quesAnswers`( `barcode`, `q1`, `q2`, `q3`, `q4`, `q5`, `q6`, `q7`, `q8`, `q9`, `q10`, `q11`, `q12`)
        values ( '$barcode', '$q1', '$q2', '$q3', '$q4', '$q5', '$q6', '$q7', '$q8', '$q9', '$q10', '$q11', '$q12') ";

    $inQuery = mysqli_query($con, $inSql) or die(mysqli_error($con));
}

0 个答案:

没有答案