I am trying to make a survey with php. I get no error message when I submit my answers, but they do not appear in my databank.

Working with php is new to me.

include('config.inc.php');          //DB-Connection

$e1 = $_POST['11'];
$e2 = $_POST["12"];
$e3a = $_POST["13a"];
$e3b = $_POST["13b"];
$e3c = $_POST["13c"];
$e3d = $_POST["13d"];
$e3e = $_POST["13e"];
$e3f = $_POST["13f"];
$e3g = $_POST["13g"];
$e3h = $_POST["13h"];

if (!empty($e1 or $e2 or $e3a or $e3b or $e3c or $e3d or $e3e or $e3f or $e3g or $e3h )) {
    $result = mysqli_query($connection, 
    'INSERT INTO umfrage1 
    (q1,q2,q3a,q3b,q3c,q3d,q3e,q3f,q3g,q3h) 
    VALUES 
    ($e1, $e2, $e3a, $e3b, $e3c, $e3d, $e3e, $e3f, $e3g, $e3h)');
    echo "<p>Thank you for participating in our survey:D</p>";
} else {
    echo "<p>You did not answer to all questions, please try again.</p>";
} 

And here is the content of the config.inc.php:

$host = "localhost";        
$user= "root";              
$passwort = "";
$datenbank = "testdatenbank";       

$connection = mysqli_connect($host, $user, $passwort) OR DIE ("No connection!");
$db = mysqli_select_db($connection, $datenbank) OR DIE (mysqli_error($connection));

0 Answers