I have this slider:
<form id="sliderForm1" action="registerValidation.php" method="POST">
<label for="sliderValue1">Kiek su tuo sutinkate?:</label>
<output id="sliderOutput1" name="sliderOutput1">0</output>
<input type="range" min="0" max="100" value="0" id="sliderValue1" name="sliderValue1">
</form>
I have some javascript file, for checking lines, but its not essential here, there are no modification of values.
I try putting it to database:
$password_hash = password_hash($_POST["password"], PASSWORD_DEFAULT);
$mysqli = require __DIR__ . "/databaseConnect.php";
$sql = "INSERT INTO user (username, email, password_hash, slider1Value) VALUES (?, ?, ?, ?)"; //////////////!!!!!!!!!!!!!!!!!!!/////////////////////
try
{
$stmt = $mysqli->prepare($sql);
$stmt->bind_param("sssi", $_POST["username"], $_POST["email"], $password_hash, $_POST["sliderValue1"]); //////////////////////////////////////////////
$stmt->execute();
header("Location: login.php");
exit;
}
catch (mysqli_sql_exception $exception)
{
if ($mysqli->errno === 1062) //dublicate key element error number
{
die("El. pašto adresas arba vartotojo vardas jau užimtas");
}
else
{
die("Klaida: " . $exception->getMessage());
}
}
DB view:
Db view
But I keep getting an error: Column ‘slider1Value’ cannot be null.
I tried to change value manually, tried to give output values to $stmt.