I have a PHP script that is supposed to save data from a select function in a database. I did the whole thing with the switch case function. The data should actually be saved, but for an incomprehensible reason, this does not happen. My script looks like this:
if(isset($_POST['acc_type'])){
$select = $_POST['acc_type'];
switch ($select) {
case '2':
$sql = "INSERT INTO userdata (accounttype) VALUES (2)";
break;
case '3':
$sql = "INSERT INTO userdata (accounttype) VALUES (3)";
break;
default:
$sql = "INSERT INTO userdata (accounttype) VALUES (1)";
echo "nothing";
break;
}
}
I have already tested whether it is due to the input (by setting an echo). But this was done. Therefore it must be due to the transfer to the database.
There should be 3 choices that are important for my login. The data should be saved as 1, 2 or 3 (depending on what is specified).
$sqlis executed. Do you?