I tried searching for codes that can help me with my problem but then I can't seem to make it work. I am new to coding these certain things. This is my first year, first semester with php actually. I hope you can help me with my project.
<?php
$fullname = $_POST['fullname'];
$gradelevel = $_POST['gradelevel'];
$section = $_POST['section'];
$servername = "localhost";
$username = "root";
$password = "";
$database = "onlinevoting";
$dbc = mysqli_connect('localhost', 'root', '', 'onlinevoting')
or die('Error connecting to MySQL server.');
$query = "INSERT INTO student_names (fullname, gradelevel, section)".
"VALUES ('$fullname', '$gradelevel', '$section')";
$result = mysqli_query($dbc, $query)
or die('Error querying databse.');
mysqli_close($dbc);
header("Location: startvote.html");
?>