douhuang1973 2017-04-04 01:38
浏览 35

PHP如何在搜索后提交许多记录

I tried to look in this site but none of the question which relate exactly like mine. I need help on this problem since am very new in PHP. Iam developing students result application which used to collect scores of the students. My problem is, I fail to submit all information I get like (idnumber, names and subject), after searching records of students of a certain class, here is my scripts.

   <?php
        $number = $courseObj->sele_ct_class($class, $year);
        ?>
                    <table class="table table-bordered" style="border-radius: 100px" border="0">
                        <tr style="font-size: medium; background-color: lavenderblush">
                            <td>#</td>
                            <td>Admission Number</td>
                            <td>Student name</td>
                            <td>Max.Mark</td>
                            <td>Mark</td>
                        </tr>
                        </thead>
                        <tbody>
                        <?php
        $i = 1;
        $notaVilableId = $courseObj->seleId($class, $year); // Select_all From curClass according to aguments (return all idnumber)
        foreach ($notaVilableId AS $haika) {
            $classIdnumber = $haika->idnumber;
            $jina = $haika->jina;

            ?>

            <tr>
                <td style="width: 5%"><?php echo $i++; ?></td>
                <td><?php echo $classIdnumber ?></td> <!-- this display idnumber -->
                <td><?php echo $jina ?></td> <!-- this display name -->
                <td>100</td>
                <td class="col-sm-2"><input type="number" id="subject" name="subject" class="form-control"></td> <!-- this fiels used to input score marks -->
            </tr>
        <?php } ?> <!-- end foreach -->

                        <tr>
                            <td colspan="20px">
                                <button class="btn btn-success" type="submit" name="fee_submit" id="fee_submit">Save
                                </button>  <!-- submission button --> 
                        </tr>

Problem is here, I get only idnumber of one student and the rest not appear, can any one show me how I could get all information like (idnumber, name and subject score which entered for each student). I mean that I want all information displayed to be submited with there scrored marks. Thank

        <?php
        if (isset($_POST['fee_submit'])) {
            $classIdnumber;
            $jina;
            $score = sanitize($_POST['subject']);
            $courseObj->insertseTExams($classIdnumber, $jina, $score); // function used to insert data

  }
  • 写回答

2条回答 默认 最新

  • dqwh0109 2017-04-04 02:34
    关注

    it seems you have assigned $classIdnumber,$jina to read its values from the $_POST super global variable.. And also, any data that is to be submitted to a server page for processing should be in-between form tags,this way you can access this values through the $_POST super global

    评论

报告相同问题?

悬赏问题

  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计