I have a form where I can mark several checkbox
at the same time and wanted to know how to identify the ones that are marked and save them in the database.
In the database I will have a table and a column for every checkbox
because this is a record of a query, and if the person is to make multiple treatments, those that are marked will give a OK
in that column in the database of data.
For example, if the person is to treat Reiki and Acupuncture , a OK
will appear in Reiki and OK
in Acupuncture.
<form name="signup" method="post" action="../cadastro_con.php">
<div>
<form name="signup" method="post" action="cadastrar.php">
<div align="center">
<table width="800" border="1" bordercolor="#B9B3B3" cellspacing=0 cellpadding=0>
<tbody>
<tr>
<td><p><br>
NOME:
<input type="text" name="nomec" size=50/>
DATA DA CONSULTA:
<input name="data" type="date" />
<br>
</p>
<table width="600" border="0" bordercolor="#B9B3B3" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="185" height="86" align="center" bordercolor="#FFFFFF" bgcolor="#DDF0DD" style="border-style:none" >TRATAMENTOS A SEREM REALIZADOS</td>
<td width="256" style="border-right-style:none">
<input type="checkbox" name="check[]" value="db">
<label>Desobsessao e Desmaterialização
</label><br>
<label>
<input type="checkbox" name="check[]" value="cr">
Cirurgias </label><br>
<label>
<input type="checkbox" name="check[]" value="rk">
Reiki
</label></td>
<td width="114" style="border-left-style:none">
<input type="checkbox" name="check[]" value="crm">
<label >Cromoterapia
</label><br>
<label>
<input type="checkbox" name="check[]" value="acp">
Acupuntura
<br>
</label>
<label>
<input type="checkbox" name="check[]" value="pdc">
Passe de Cura
</label></td>
</tr>
</tbody>
</table>
</form>
I did not put the whole code, but after that if I click on register, it calls the page that will enter the data in the database. There will be a column for each option and if it is checked, it will store a OK
.
If anyone knows how to do this and can help me, thank you.