I'm making a form with PHP and HTML where when tagging several checkbox
should I get them and insert into my database.
But I can only receive one, for example, if I tick 2% with% I will only receive the last chekbox
selected, what should I do to get all those selected?
My checkbox
:
<form method="POST" action="cadastra.php">
<input type="checkbox" name="situacao" value="bom" />bom
<input type="checkbox" name="situacao" value="regular" />Regular
<input type="checkbox" name="situacao" value="inrregular" />Inrregular
<input type="submit" value="Cadastrar" />
</form>
My form.php
:
$situacao = $_POST['situacao'];
$servidor = "localhost";
$usuario = "root";
$senha = "";
$dbname = "form";
$conn = mysqli_connect($servidor, $usuario, $senha, $dbname); // faz a conexao
//INSERT INTO FORMULARIO SITUACAO =
//ESCOLHE A TABELA SITUAÇAO DA TABELA FORMULARIO
//VALUES('$SITUACAO') = RECEBE OS VALORES QUE TÊM O NAME SITUAÇAO
$result_formulario = "INSERT INTO formulario(situacao) VALUES ('$situacao')";
$resultado_formulario = mysqli_query($conn, $result_formulario);