J'ai pu réalisé un formulaire de saisie de données pour un dossier médical en 3 étapes dans une même table Mysql.
Les données sont enregistrées mais j'ai trois differents dossiers, chacun a seulement les données d'un seul formulaire.
Je cherche un méthode si possible pour que les trois formulaires enregistrent les données pour le même ID.
Merci pour votre aide.
Mon code de la premiere page "nouveau dossier.php"
<?php require_once('../Connections/elmawloud_intra.php');
require_once "../maincore.php";
require_once "../subheader.php";
require_once "../side_left.php"; ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "insertion")) {
$insertSQL = sprintf("INSERT INTO dossier_patients (nom_h, nom_f, prenom_h, prenom_f, date_n_f, lieu_n_h, lieu_n_f, adresse_h, adresse_f, tel_h, tel_f, prof_h, prof_f, groupe_h, groupe_f, date_mariage, origine) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nom_h'], "text"),
GetSQLValueString($_POST['nom_f'], "text"),
GetSQLValueString($_POST['prenom_h'], "text"),
GetSQLValueString($_POST['prenom_f'], "text"),
GetSQLValueString($_POST['date_n_f'], "text"),
GetSQLValueString($_POST['lieu_n_h'], "text"),
GetSQLValueString($_POST['lieu_n_f'], "text"),
GetSQLValueString($_POST['adresse_h'], "text"),
GetSQLValueString($_POST['adresse_f'], "text"),
GetSQLValueString($_POST['tel_h'], "text"),
GetSQLValueString($_POST['tel_f'], "text"),
GetSQLValueString($_POST['prof_h'], "text"),
GetSQLValueString($_POST['prof_f'], "text"),
GetSQLValueString($_POST['groupe_h'], "text"),
GetSQLValueString($_POST['groupe_f'], "text"),
GetSQLValueString($_POST['date_mariage'], "text"),
GetSQLValueString($_POST['origine'], "text"));
mysql_select_db($database_elmawloud_intra, $elmawloud_intra);
$Result1 = mysql_query($insertSQL, $elmawloud_intra) or die(mysql_error());
$insertGoTo = "bilan.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_elmawloud_intra, $elmawloud_intra);
$query_nouveau_dossier = "SELECT nom_h, nom_f, prenom_h, prenom_f, date_n_h, date_n_f, lieu_n_h, lieu_n_f, adresse_h, adresse_f, tel_h, tel_f, prof_h, prof_f, groupe_h, groupe_f, allergies_h, alergies_f, date_mariage, infertilite_primaire, infertilite_secondaire, infertilite_anciete, origine, id FROM dossier_patients";
$nouveau_dossier = mysql_query($query_nouveau_dossier, $elmawloud_intra) or die(mysql_error());
$row_nouveau_dossier = mysql_fetch_assoc($nouveau_dossier);
$totalRows_nouveau_dossier = mysql_num_rows($nouveau_dossier);
?>
<? echo "<table border='0' style='border: 1px solid #FF9900' cellspacing='1' width='100%' cellpadding='3' valign='top'><tr>";
echo "<td class='panel-faq' height='20' width='100%'>Nouveau Dossier</td></tr>";
echo "<tr><td class='main-body' width='100%' align='right'>";
echo "</td></tr></table><br>";?>
<? echo "<center><b><font color='#ff9900'>Etape 1 : Informations Générales</font></b></center><br>"; ?>
<form action="<?php echo $editFormAction; ?>" id="insertion" name="insertion" method="POST">
<table width="95%" border="0" align="center" cellpadding="2" cellspacing="2" onafterupdate="MM_validateForm('nom_h','','R','nom_f','','R','prenom_h','','R','prenom_f','','R','date_h','','R','date_n_f','','R','lieu_n_h','','R','lieu_n_f','','R','tel_h','','R','tel_f','','R','prof_h','','R','prof_f','','R','groupe_h','','R','groupe_f','','R','allerigies_h','','R','allerigies_f','','R','date_mariage','','R','primaire','','R','secondaire','','R','anciennete','','R','origine','','R','adresse_h','','R','adresse_f','','R');return document.MM_returnValue">
<tr>
<td width="28%"> </td>
<td width="30%" align="center" bgcolor="#ff9900"><strong>Homme</strong></td>
<td width="42%" align="center" bgcolor="#ff9900"><strong>Femme</strong></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Nom</td>
<td align="center" bgcolor="#e4e2e2"><input name="nom_h" type="text" class="textbox" id="nom_h" /></td>
<td align="center" bgcolor="#e4e2e2"><input name="nom_f" type="text" class="textbox" id="nom_f" /></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Prénom</td>
<td align="center" bgcolor="#e4e2e2"><input name="prenom_h" type="text" class="textbox" id="prenom_h" /></td>
<td align="center" bgcolor="#e4e2e2"><input name="prenom_f" type="text" class="textbox" id="prenom_f" /></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Date de naissance</td>
<td align="center" bgcolor="#e4e2e2"><input name="date_h" type="text" class="textbox" id="date_h" /></td>
<td align="center" bgcolor="#e4e2e2"><input name="date_n_f" type="text" class="textbox" id="date_n_f" /></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Lieu de naissance</td>
<td align="center" bgcolor="#e4e2e2"><input name="lieu_n_h" type="text" class="textbox" id="lieu_n_h" /></td>
<td align="center" bgcolor="#e4e2e2"><input name="lieu_n_f" type="text" class="textbox" id="lieu_n_f" /></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Adresse</td>
<td align="center" bgcolor="#e4e2e2"><textarea name="adresse_h" cols="35" class="textbox" id="adresse_h"></textarea></td>
<td align="center" bgcolor="#e4e2e2"><textarea name="adresse_f" cols="35" class="textbox" id="adresse_f"></textarea></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Numéro de Tél. </td>
<td align="center" bgcolor="#e4e2e2"><input name="tel_h" type="text" class="textbox" id="tel_h" /></td>
<td align="center" bgcolor="#e4e2e2"><input name="tel_f" type="text" class="textbox" id="tel_f" /></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Profession</td>
<td align="center" bgcolor="#e4e2e2"><input name="prof_h" type="text" class="textbox" id="prof_h" /></td>
<td align="center" bgcolor="#e4e2e2"><input name="prof_f" type="text" class="textbox" id="prof_f" /></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Groupage</td>
<td align="center" bgcolor="#e4e2e2"><input name="groupe_h" type="text" class="textbox" id="groupe_h" /></td>
<td align="center" bgcolor="#e4e2e2"><input name="groupe_f" type="text" class="textbox" id="groupe_f" /></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Allérgies</td>
<td align="center" bgcolor="#e4e2e2"><input name="allerigies_h" type="text" class="textbox" id="allerigies_h" /></td>
<td align="center" bgcolor="#e4e2e2"><input name="allerigies_f" type="text" class="textbox" id="allerigies_f" /></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Date de mariage </td>
<td colspan="2" align="center" bgcolor="#e4e2e2"><input name="date_mariage" type="text" class="textbox" id="date_mariage" value=""></td>
</tr>
<tr>
<td align="center"> </td>
<td colspan="2" align="center" bgcolor="#ff9900"><strong>Infertilité</strong></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Primaire</td>
<td colspan="2" bgcolor="#e4e2e2"><input name="primaire" type="text" class="textbox" id="primaire" value=""></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Secondaire</td>
<td colspan="2" bgcolor="#e4e2e2"><input name="secondaire" type="text" class="textbox" id="secondaire" value=""></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Ancienneté</td>
<td colspan="2" bgcolor="#e4e2e2"><input name="anciennete" type="text" class="textbox" id="anciennete" value=""></td>
</tr>
<tr>
<td bgcolor="#e4e2e2">Origine</td>
<td colspan="2" bgcolor="#e4e2e2"><input name="origine" type="text" class="textbox" id="origine" value=""></td>
</tr>
<tr>
<td> </td>
<td align="center"><input name="Submit2" type="reset" class="button" value="EFFACER" /></td>
<td align="center"><input name="Submit" type="submit" class="button" onclick="MM_validateForm('nom_h','','R');return document.MM_returnValue" value="VALIDER" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="insertion">
</form>
<?
require_once "../side_right.php";
require_once "../footer.php";
?>
<?php
mysql_free_result($nouveau_dossier);
?>