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
| <?php
$bdd = new PDO('mysql:host=localhost; dbname=archivesv1', 'root', '');
//-------------- Services
include('transfererB.php');
$combo = getServices($bdd);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="design.css">
<title>Transférer</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
function modifier(id)
{
var id_service = document.getElementById('service_'+id).value;
var tdId = "#cmb_"+id;
$.ajax
({
type: "POST",
url: "transfererC.php",
data:{id: id, id_service: id_service},
dataType: "html",
success: function(msg)
{
if (msg =="ko")
{
alert("Paramètres mal passés !!!");
return;
}
$(tdId).html(msg);
}
});
}
</script>
</head>
<body>
<?php
include "nav.php";
nav()
?>
<form method="POST" action="">
<input type="text" name="nom" placeholder="Nom du patient" class="textbox">
<input type="submit" value="Chercher" class="bouton">
</form>
<br><br>
<h1 align="center">Transférer un patient</h1><br><hr><br>
<table border="1" align="center" class="table">
<tr>
<th>Nom</th>
<th>Prénom</th>
<th>Service</th>
<th></th>
</tr>
<?php
//------------- Patients - j'utilise query parce que j'ai récupéré du code déjà écrit
$requete = "SELECT `id`, `nom`, `prenom`, `id_service` FROM patient ORDER BY nom, prenom";
$query = $bdd->query($requete);
while($row=$query->fetch(PDO::FETCH_OBJ))
{
//Mettre la ligne dans le tableau
$id_patient = $row->id;
$nom_pat = $row->nom;
$prenom_pat = $row->prenom;
$service_pat= $row->id_service;
$sav_combo = newCombo($combo,$id_patient,$service_pat);
?>
<tr>
<td><?php print $nom_pat;?></td>
<td><?php print $prenom_pat;?></td>
<td id="cmb_<?php print $id_patient;?>">
<?php print $sav_combo;?>
</td>
<td>
<input type="button" value="Modifier" class="boutonTransferer" onclick="modifier(<?php print $id_patient;?>)"/>
</td>
</tr><?php
}?>
</table>
</body>
</html> |
Partager