Does not insert table

0

I have this code:

<?php  
$servername = "xxx.xxx.x.xx";
$username = "xxxxx";
$password = "xxxxxxx";
$dbname = "xxxxxxx";

$conn = new mysqli($servername, $username, $password, $dbname);
$conn->set_charset('utf8');

$data = $_POST['DataEntrada'];  
$utente = $_POST['Utente'];
$observacao = $_POST['Observacao'];
$estado = $_POST['Estado'];
$colaborador = $_POST['Colaborador']

$sql = "INSERT INTO regOratorio ('DataEntrada','Utente','Observacao','Colaborador') 
VALUES ('$data','$utente','$observacao','$colaborador')";

if ($conn->query($sql) === TRUE) {
$last_id = $conn->insert_id;
} 

$sql1 = "INSERT INTO EstadoOratorio ('IdOrat','Estado') 
VALUES ('$last_id','$estado')"; 

 if ($conn->query($sql1) === TRUE);

$rowCount = $query->num_rows;

$conn->close();
 ?> 

<form name="customer_details" method="POST" onsubmit="return form_validation()" >
<h1><center><strong>Listagem Para Orientação da Participação Para o Oratório</strong></center></h1></br>
</br> 
 
 <fieldset>
 <table cellspacing="10">
 <tr>
   <td>
 <p><h5><strong>Data Oratório</strong></h5> <input type="date" required="" id="DataEntrada" name="DataEntrada" value="<?php echo date("Y-m-d");?>" /><br/></p>
	</td>
</tr>
 </table>
</fieldset>
 
 <fieldset>
 <table cellspacing="10">
 <tr>
   <td>
<label for=""><h5><strong>Utente</strong></h5></label>
    <select id="Utente" name="Utente">
      <option value="1">Carminda Alves</option> 
	  </select> <input type="radio" name="Estado" value="Presente" required>Presente &nbsp;&nbsp;&nbsp; <input type="radio" name="Estado" value="Ausente" required>Ausente <input type="text" id="observacao" name="observacao" size="40" > 
	  </td>
	  </tr>
 </table>
</fieldset>



<fieldset>
 <table cellspacing="10">
 <tr>
   <td>
<label for=""><h5><strong>Responsável de Turno</strong></h5></label>
<select name="Colaborador">
       <option value="0">Selecione Colaborador</option>
        <?php
         $servername = "xxx.xxx.x.xx";
$username = "xxxxx";
$password = "xxxxxx";
$dbname = "xxxxxxxx";

$conn = new mysqli($servername, $username, $password, $dbname);
$conn->set_charset('utf8'); 
        
         $sql = "SELECT * FROM centrodb.InfoLuvas WHERE Funcao = 'AAD' ORDER BY Funcionario ASC";
         $qr = mysqli_query($conn, $sql);
         while($ln = mysqli_fetch_assoc($qr)){
            echo '<option value="'.$ln['Id'].'">'.$ln['Funcionario'].'</option>';
         }
      ?>        
    </select>
</td>
</tr>
 </table>
</fieldset>
<input type="submit" value="Registar"/>
</form>

But when I fill in the form it does not insert the data into the tables.

    
asked by anonymous 01.02.2018 / 18:40

1 answer

0

Your are out of action.

Ex:

<form name="customer_details" action="minhapagina.php" method="POST" onsubmit="return form_validation()" >
<h1><center><strong>Listagem Para Orientação da Participação Para o Oratório</strong></center></h1></br>
</br> 

 <fieldset>
 <table cellspacing="10">
 <tr>
   <td>
 <p><h5><strong>Data Oratório</strong></h5> <input type="date" required="" id="DataEntrada" name="DataEntrada" value="<?php echo date("Y-m-d");?>" /><br/></p>
    </td>
</tr>
 </table>
</fieldset>

 <fieldset>
 <table cellspacing="10">
 <tr>
   <td>
<label for=""><h5><strong>Utente</strong></h5></label>
    <select id="Utente" name="Utente">
      <option value="1">Carminda Alves</option> 
      </select> <input type="radio" name="Estado" value="Presente" required>Presente &nbsp;&nbsp;&nbsp; <input type="radio" name="Estado" value="Ausente" required>Ausente <input type="text" id="observacao" name="observacao" size="40" > 
      </td>
      </tr>
 </table>
</fieldset>



<fieldset>
 <table cellspacing="10">
 <tr>
   <td>
<label for=""><h5><strong>Responsável de Turno</strong></h5></label>
<select name="Colaborador">
       <option value="0">Selecione Colaborador</option>
        <?php
         $servername = "xxx.xxx.x.xx";
$username = "xxxxx";
$password = "xxxxxx";
$dbname = "xxxxxxxx";

$conn = new mysqli($servername, $username, $password, $dbname);
$conn->set_charset('utf8'); 

         $sql = "SELECT * FROM centrodb.InfoLuvas WHERE Funcao = 'AAD' ORDER BY Funcionario ASC";
         $qr = mysqli_query($conn, $sql);
         while($ln = mysqli_fetch_assoc($qr)){
            echo '<option value="'.$ln['Id'].'">'.$ln['Funcionario'].'</option>';
         }
      ?>        
    </select>
</td>
</tr>
 </table>
</fieldset>
<input type="submit" value="Registar"/>
</form>
    
01.02.2018 / 19:04