通过php表单更新数据库

通过php表单更新数据库,php,sql,Php,Sql,代码正常执行,但当用户选择更新时,代码不会执行它应该执行的操作,即使用查询更新数据库。我已经测试了这个查询,它运行得很好。我已经查看了讨论相同问题的其他问题,但是我没有找到解决这些问题的方法 <?php $s_course = $_POST['course_id']; ... $conn=oci_connect("****" , "****" , "****"); $sql=oci_parse($conn, "select * from evaluate w

代码正常执行,但当用户选择更新时,代码不会执行它应该执行的操作,即使用查询更新数据库。我已经测试了这个查询,它运行得很好。

我已经查看了讨论相同问题的其他问题,但是我没有找到解决这些问题的方法

<?php
    $s_course = $_POST['course_id'];
    ...
    $conn=oci_connect("****" , "****" , "****");
    $sql=oci_parse($conn, "select * from evaluate where Course_ID ='$s_course'and Section = '$s_section' and Exam_Type = '$s_exam_type' and Exam_ID = '$s_exam_num' and Roll_Number = '$s_roll_no'");
    oci_execute($sql);
    $row=oci_fetch_array($sql);
    echo "<table align='center'>";
    echo "<tr class='header'><td>Roll No.</td><td>Marks Scored</td><td>Attendence</td><td>New Marks</td></tr>";
    echo "<tr><td>$row[0]</td><td>$row[4]</td><td>$row[5]</td><td>";
?>
    <form method="post" action="update_student_marks.php">
        <input type="number" name="newmarks"></input>
    </form>
<?php
    echo  "</td></tr>";
    echo "</table>";
?>
    <form method="post" action="update_student_marks.php">
        <input type="submit" name="update" value="Update"></input>
    </form>
<?php

    if(isset($_POST["update"]))        // not coming in even if 'Update' key is pressed
    {
        $sql=oci_parse($conn, "update evaluate set Marks = '$_update_marks' where Course_ID ='$s_course' and Section = '$s_section' and Exam_Type = '$s_exam_type' and Exam_ID = '$s_exam_num' and Roll_number = '$s_roll_no'");
        oci_execute($sql);

        $sql=oci_parse($conn, "commit");
        oci_execute($sql);
    }
?>

使用此
或die(oci_error($conn))
进行测试当您使用HTML
时,您需要在开始和结束标记之间具有所有输入。目前,您的更新表单只包含一个提交按钮,在这里定义了变量?????看起来一切正常。让我们做一个合理性检查:
if(isset($\u POST[“update”])//即使按下“update”键也不进来{$sql=oci\u parse($conn,“update evaluate set Marks=“$\u update\u Marks”其中Course\u ID=“$s\u Course”和Section=“$s\u Section”和test\u Type=“$s\u test\u Type”和test\u ID=“$s\u test\u num”和Roll\u number=“$s\u Roll\u no”);oci_execute($sql);$sql=oci_parse($conn,“commit”);oci_execute($sql);}否则{var_dump($_POST)}
@StaticVoid,'if'单独工作,但当我以这种方式使用它时,它就不工作了,我不明白为什么。