2
I have a form on which I will be able to mark several checkbox at the same time and wanted to know how I identify those marked and save them in the database.
On the bench I’ll have a table and a column for each checkbox because this is a record of a consultation, and if the person is going to do several treatments, those that are marked will give a OK in that column in the database.
For example if the person is going to have Reiki and of Acupuncture, there’s gonna be a OK in Reiki and a 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 didn’t put all the code, but after that if I click register, it calls the page that will insert the data in the database. There will be a column for each option and if it is checked, it will store one OK.
If anyone knows how to do that and can help me, I’d appreciate it.
What’s the problem? Wouldn’t it be better to store checkboxes in a separate table? e.g., query and itens_query ?
– rray
I need to save what the person will do for treatment because then I will show this data in the general report and still have the days of presence. each day of the week is an intact treatment who have doing Iki I will list people in Iki.
– Kelly Cris
Puts the table structure
– rray