**it throws an error
Undefined offset: 0 in C:\xampp\htdocs\test_login\add_data.php on line 10
line 10 has $_SERVER["REQUEST_METHOD" == "POST"]**
<?php 
require_once 'mysql_connect.php';
if ($_SERVER["REQUEST_METHOD" == "POST"]) {
    if (empty($_POST['username'])) {
        echo "Username required.";
    }else{
    $username = handle_data($_POST['username']);
    }
    if (empty($_POST['password'])) {
        echo "Password required.";
    }
    else{
    $password = handle_data($_POST['password']);
    }
    if ($_POST['cpassword'] != $_POST['password']) {
        echo "Passwords donot match!";
    }
    if (!is_numeric($_POST['age'])) {
        echo "Age must be a number.";
    }
$query = "INSERT INTO students(username, password, age) VALUES(?, ?, ?)";
$stmt = mysql_stmt_prepare($conn, $query);
if ($stmt) {
    mysqli_stmt_bind_param($stmt, 'ssi', $username, $password, $age );
    mysqli_execute($stmt);
    echo "Registration Made!";
    mysqli_stmt_close($stmt);
    mysqli_close($conn);
}
}
function handle_data($data){
$data = trim($data);
$data = stripcslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
What is the actual error it is pointing at??
 
     
     
    