It's quite simple, just for study.
I have a form and a table in the database with a field of type DECIMAL. I can already save in the database, but if I type in the input a value of type "1,280.90", in my database it saves only as "1":
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jJulius</title>
</head>
<body>
<?php
$servername = "localhost";
$database = "jjulius";
$username = "root";
$password = "";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
<?php
if(isset($_POST['save']))
{
$valor=$_POST['valor'];
$sql = "INSERT INTO valor (valor) VALUES ";
$sql .= "('$valor')";
mysqli_query($conn,$sql) or die("Erro ao tentar cadastrar registro");
mysqli_close($conn);
}
?>
<form action="" method="post">
<input type="text" name="valor" />
<button type="submit" name="save">Enviar</button>
</form>
</body>
</html>
Can anyone help me with how to save and display this data correctly, please?
Thank you in advance. :)