loader image

PHP Program to display the mark list of a student

Create a table student with fields roll no, name, mark, grade. Insert some records in the table. Write a PHP program to display the mark list of a student by accepting the register no of the student.

<html>

<body>
    <h1>Marksheet</h1>
    <form method="POST" action="">
        Regno: <input type="text" name="txtreg" />
        <input type="submit" value="Get Result">
    </form>
</body>

</html>

<?php
if ($_POST) {
    $rg = $_POST['txtreg'];
    echo $rg;
    $con = mysqli_connect("localhost","user","password","database");
    if ($con)
        echo "Successfully Connected.";
    $qry = "select * from result where regno=$rg";
    $result = mysqli_query($con, $qry);
    $nos = mysqli_num_rows($result);
    while ($row = mysqli_fetch_row($result)) {
        echo "<br>\n";
        echo "rollno: $row[0] name: $row[1] mark: $row[2] grade: $row[3]";
    }
}
?>
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Scroll to Top