How to send custom form submissions to WordPress Database?

Have seen it now, lastname and consent have $POST instead of $_POST, $POST it will be a php variable, the correct is $_POST. Maybe the error is that all along.

Anyhow, with query must work, if it doesnt or is the sql statement not correct or there is no connection with the database

global $wpdb;
$wpdb->query($wpdb->prepare("update pro_slider set pos = {$d} where id = {$f->id};"));

this is something I use, to update a banner in my case.
for your case you should use the insert statement.

global $wpdb;
$wpdb->query($wpdb->prepare("insert into {$table_name} values ( 0 , 0, 0, 0  ) ")); 

just replace the zeros with the desired, I would try before use hard code values, if it works, it’s all working just fine, just replace the hard code (writted values) with the variables, just bear in mind that varchar could need comas, and sometimes sql statment is a little weird with $_POST directly on the sql statement, sometimes need to have it on a php variable.

alright,this is what I would do step by step to check the issue.

global $wpdb;
$first_name = $_POST['fname'];
$LastName = $_POST['lname'];
$Consent = $_POST['consent'];
$sql = "insert into {$table_name} values ( {$first_name} , {$LastName}, {$Consent} )";
echo '<pre>';
print_r($sql);
echo '</pre>';
die();

this should print something like

insert into custom_table values ( ‘Brad’, ‘Pitt’, 1)

in this case the statment is correct, however if it prints like this

insert into custom_table values ( Brad, Pitt, 1)

this isnt correct, Brad is not a varchar and needs to be between comas, so lets insert comas in the code:

global $wpdb;
$first_name = $_POST['fname'];
$LastName = $_POST['lname'];
$Consent = $_POST['consent'];
$sql = "insert into {$table_name} values ( '{$first_name}' , '{$LastName}', '{$Consent}' )";
echo '<pre>';
print_r($sql);
echo '</pre>';
die();

one of this will work just fine, I believe is the first, now just copy the $sql and use it inside the wpdb->query

global $wpdb;
$first_name = $_POST['fname'];
$LastName = $_POST['lname'];
$Consent = $_POST['consent'];
$wpdb->query($wpdb->prepare("insert into {$table_name} values ( {$first_name} , {$LastName}, {$Consent} ) "));