-2
Good people, I have the following complication, each patient has a so-called "PII" and this same "PII" has several data. The problem is when filling the PII by clicking write it simply wipes me all data instead of storing in the database.
The initial snippet of php connecting to Mysql:
<?php
session_start();
error_reporting(0);
include('includes/config.php');
if(strlen($_SESSION['alogin'])==0)
{
header('location:index.php');
}
else{
if(isset($_POST['add']))
{
$avinicial=$_POST['AvInicial'];
$meta=$_POST['Meta'];
$avintercalar=$_POST['AvIntercalar'];
$avfinal=$_POST['AvFinal'];
$datainicio=$_POST['DataInicio'];
$datafim=$_POST['DataFim'];
$resultadouni=$_POST['ResultadoUni'];
$avalexp=$_POST['AvalExpec'];
$concretizaobj=$_POST['ConcretizaObj'];
$objdefinidos=$_POST['ObjDefinidos'];
$objatingidos=$_POST['ObjAtingidos'];
$totalalcancados=$_POST['TotalAlcancados'];
$sql = "INSERT INTO tblobjetivos(AvInicial, Meta, AvIntercalar, AvFinal, DataInicio, DataFim, ResultadoUni, AvalExpec, ConcretizaObj, ObjDefinidos, ObjAtingidos, TotalAlcancados) VALUES(:avinicial, :meta, :avintercalar, :avfinal, :datainicio, :datafim, :resultadouni, :avalexp, :concretizaobj, :objdefinidos, :objatingidos, :totalalcancados)";
$query = $dbh->prepare($sql);
$query->bindParam(':avinicial', $avinicial, PDO::PARAM_STR);
$query->bindParam(':meta', $meta, PDO::PARAM_STR);
$query->bindParam(':avintercalar', $avintercalar, PDO::PARAM_STR);
$query->bindParam(':avfinal', $avfinal, PDO::PARAM_STR);
$query->bindParam(':datainicio', $datainicio, PDO::PARAM_STR);
$query->bindParam(':datafim', $datafim, PDO::PARAM_STR);
$query->bindParam(':resultadouni', $resultadouni, PDO::PARAM_STR);
$query->bindParam(':avalexp', $avalexp, PDO::PARAM_STR);
$query->bindParam(':concretizaobj', $concretizaobj, PDO::PARAM_STR);
$query->bindParam(':objdefinidos', $objdefinidos, PDO::PARAM_STR);
$query->bindParam(':objatingidos', $objatingidos, PDO::PARAM_STR);
$query->bindParam(':totalalcancados', $totalalcancados, PDO::PARAM_STR);
$lastInsertId = $dbh->lastInsertId();
$query->execute();
if ($lastInsertId) {
$msg = "PII Adicionado com Sucesso";
} else {
$error = "Confirme se preencheu tudo corretamente!";
}
}?>
Need to be more clear on the question. Clear how? Clear where or what exactly?
– Sam
When I click for the form data to be stored in the database, everything I filled in the form disappears and in the database no value appears.
– fff
@sam the problem is that each patient can have up to 12 goals, ie are 12 times each table objective understand? how can I do this store right in the database? I should create some more table?
– fff
@Bacco if you had already said it in another question why do you have to say it again? Just once my dear. But thank you for the time of your life you lost trying to "help" me! Greetings!
– fff