1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| <script type="text/javascript">
function affect(id)
{
document.reponse.vote.value=id;
}
function valid()
{
document.reponse.submit();
}
</script>
</form>
<form name="reponse" method="POST" action="index.php?page=accueil">
<input type="hidden" name="vote" value="">
</form>
<?php
require('connect.php');
$r1 = 0;
$r2 = 0;
$r3 = 0;
$r4 = 0;
$r5 = 0;
$tr1 = 0;
$tr2 = 0;
$tr3 = 0;
$tr4 = 0;
$tr5 = 0;
$sql = mysql_query("SELECT * FROM r2sdmp", $connexion);
$nbl = mysql_num_rows($sql);
$i = 0;
while ($i<$nbl)
{
$r1 = mysql_result($sql,$i,"plusoui");
$r2 = mysql_result($sql,$i,"oui");
$r3 = mysql_result($sql,$i,"non");
$r4 = mysql_result($sql,$i,"plusnon");
$r5 = mysql_result($sql,$i,"aucun");
$tr1 += $r1;
$tr2 += $r2;
$tr3 += $r3;
$tr4 += $r4;
$tr5 += $r5;
$i++;
}
?>
<form name="question" method="POST" action="index.php?page=accueil">
<table border="1" width= 37% style="margin-top:-245px; margin-left:700px" style="font-family:verdana; font-size:11px" rules="none">
<colgroup width=60px>
<colgroup width=50px>
<tr><td align="center" colspan="2"><b> Enquête sur le Dossier Médical Personnel (DMP)</td></tr>
<tr><td colspan="2">- Pensez-vous que le numéro de Sécurité Sociale doit devenir<br> la clé d'accès du DMP ?</td></tr>
<tr><td align="center">Votre opinion</td><td align="center">Les réponses</td></tr>
<tr><td><input type="radio" name="dmp" value='1' onclick="javascript:affect(this.value);"> Tout à fait d'accord</td><td><?php echo $tr1; ?></td></tr>
<tr><td><input type="radio" name="dmp" value='2' onclick="javascript:affect(this.value);"> Plutôt d'accord</td><td><?php echo $tr2; ?></td></tr>
<tr><td><input type="radio" name="dmp" value='3' onclick="javascript:affect(this.value);"> Plutôt pas d'accord</td><td><?php echo $tr3; ?></td></tr>
<tr><td><input type="radio" name="dmp" value='4' onclick="javascript:affect(this.value);"> Pas d'accord du tout</td><td><?php echo $tr4; ?></td></tr>
<tr><td><input type="radio" name="dmp" value='5' onclick="javascript:affect(this.value);"> Ne sais pas<br></td><td><?php echo $tr5; ?></td></tr>
<tr><td align="center" colspan="2"><input type="button" value="valider" style="height:20px" onclick="javascript:valid()">
</table>
</form>
<?php
if (isset($_POST['vote'])) $vote=$_POST['vote'];
else $vote="";
if (!empty($_POST['vote'])){
$vote = $_POST['vote'];
$plusoui=0;
$oui=0;
$non=0;
$plusnon=0;
$aucun=0;
if ($vote == 1){
$plusoui=1;
}
else if ($vote==2){
$oui=1;
}
else if ($vote==3){
$non=1;
}
else if ($vote==4){
$plusnon=1;
}
else if ($vote==5){
$aucun=1;
}
$sql = "INSERT INTO r2sdmp(id_dmp, plusoui,oui,non,plusnon,aucun)
VALUES('','$plusoui', '$oui', '$non', '$plusnon', '$aucun')";
// on insère les informations du formulaire dans la table
mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());
mysql_close(); // on ferme la connexion
}
?> |
Partager