Untitled
raw download clone
TEXT
views 19
,
size 615 b
if (isset($_POST["task-name"])) {
        require_once "inc/dbconn.inc.php";
        $val = htmlspecialchars($_POST["task-name"]);
        $sql = "INSERT INTO Task(name) VALUES('$val');";
        
        $statement = mysqli_stmt_init($conn);

        $test = mysqli_stmt_prepare($statement, $sql);
        mysqli_stmt_bind_param($statement, 's', $val);
        if (mysqli_stmt_execute($statement)) {
            mysqli_close($conn);
            header("location: index.php");
        }
        else {
            echo mysqli_error($conn);
            mysqli_close($conn);
        }
        
    }
close fullscreen
Login or Register to edit or fork this paste. It's free.