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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
| <?php
mysql_connect("localhost","root","sim123");
mysql_select_db("test");
if (isset($_GET['id']))
{
$reponse = mysql_query("SELECT id, nom, prenom, age, sexe, fonction, acariens, pollen, nourriture, animaux, autre2, commentaires FROM personne WHERE id=".$_GET['id']."");
while ($donnees = mysql_fetch_array($reponse))
{
?>
<tr>
<td>Nom</td>
<td>
<input type=text name="nom" value="<?php echo $donnees['nom'];?>">
</td>
</tr>
<tr>
<td>Prenom</td>
<td>
<input type=text name="prenom" value="<?php echo $donnees['prenom'];?>">
</td>
</tr>
<tr>
<td>Age</td>
<td>
<input type=text name="age" value="<?php echo $donnees['age'];?>">
</td>
</tr>
<tr>
<td>Sexe</td>
<td>
Homme : <input type=radio name="sexe" value="M" <?php if ($donnees['sexe']=="M") { ?>checked="checked" <?php } ?>>
<br>Femme : <input type=radio name="sexe" value="F" <?php if ($donnees['sexe']=="F") { ?>checked="checked" <?php } ?>>
</td>
</tr>
<tr>
<td>Fonction</td>
<td>
<select name="fonction">
<option value="ouvrier" <?php if ($donnees['fonction']=="ouvrier") { ?>selected="selected" <?php } ?>>Ouvrier</option>
<option value="cadre" <?php if ($donnees['fonction']=="cadre") { ?>selected="selected" <?php } ?>>Cadre</option>
<option value="enseignant" <?php if ($donnees['fonction']=="enseignant") { ?>selected="selected" <?php } ?>>Enseignant</option>
<option value="etudiant" <?php if ($donnees['fonction']=="etudiant") { ?>selected="selected" <?php } ?>>Etudiant</option>
<option value="ingenieur" <?php if ($donnees['fonction']=="ingenieur") { ?>selected="selected" <?php } ?>>Ingenieur</option>
<option value="retraite" <?php if ($donnees['fonction']=="retraite") { ?>selected="selected" <?php } ?>>Retraite</option>
<option value="autre" <?php if ($donnees['fonction']=="autre") { ?>selected="selected" <?php } ?>>Autre</option>
</select>
</td>
</tr>
<tr>
<td>Allergie(s)</td>
<td>
<input type="checkbox" name="acariens" <?php if ($donnees['acariens']==1) { ?>checked="checked" <?php } ?> /> <label>acariens</label>
<input type="checkbox" name="pollen" <?php if ($donnees['pollen']==1) { ?>checked="checked" <?php } ?> /> <label>pollen</label>
<input type="checkbox" name="nourriture" <?php if ($donnees['nourriture']==1) { ?>checked="checked" <?php } ?> /> <label>nourriture</label><br />
<input type="checkbox" name="animaux" <?php if ($donnees['animaux']==1) { ?>checked="checked" <?php } ?> /> <label>animaux</label>
<input type="checkbox" name="autre2" <?php if ($donnees['autre2']==1) { ?>checked="checked" <?php } ?> /> <label>autre</label>
</td>
</tr>
<tr>
<td>Commentaires</td>
<td>
<textarea rows="3" name="commentaires">
<?php echo $donnees['commentaires'];?></textarea>
</td>
</tr>
<tr>
<td colspan=3>
<input type="button" value="Retour" onclick="document.location.href='liste.php'">
<input type="button" value="Supprimer" onclick="if (confirm('Etes-vous sur de vouloir supprimer?') == true) { <?php mysql_query("DELETE FROM personne WHERE id=".$_GET['id'].""); ?> };">
<input type="submit" value="Envoyer" onclick="alert('Votre profil a ete enregistre');">
</td>
</tr>
<?php
}
}
else {
?>
<tr>
<td>Nom</td>
<td>
<input type=text name="nom">
</td>
</tr>
<tr>
<td>Prenom</td>
<td>
<input type=text name="prenom">
</td>
</tr>
<tr>
<td>Age</td>
<td>
<input type=text name="age">
</td>
</tr>
<tr>
<td>Sexe</td>
<td>
Homme : <input type=radio name="sexe" value="M">
<br>Femme : <input type=radio name="sexe" value="F">
</td>
</tr>
<tr>
<td>Fonction</td>
<td>
<select name="fonction">
<option value="ouvrier">Ouvrier</option>
<option value="cadre">Cadre</option>
<option value="enseignant">Enseignant</option>
<option value="etudiant">Etudiant</option>
<option value="ingenieur">Ingenieur</option>
<option value="retraite">Retraite</option>
<option value="autre">Autre</option>
</select>
</td>
</tr>
<tr>
<td>Allergie(s)</td>
<td>
<input type="checkbox" name="acariens" /> <label>acariens</label>
<input type="checkbox" name="pollen" /> <label>pollen</label>
<input type="checkbox" name="nourriture" /> <label>nourriture</label><br />
<input type="checkbox" name="animaux" /> <label>animaux</label>
<input type="checkbox" name="autre2" /> <label>autre</label>
</td>
</tr>
<tr>
<td>Commentaires</td>
<td>
<textarea rows="3" name="commentaires">
Tapez ici vos commentaires</textarea>
</td>
</tr>
<tr>
<td colspan=3>
<input type="button" value="Retour" onclick="document.location.href='liste.php'">
<input type="button" value="Supprimer" onclick="if (confirm('Etes-vous sur de vouloir supprimer?') == true) { <?php mysql_query("DELETE FROM personne WHERE id=".$_GET['id'].""); ?> };">
<input type="submit" value="Envoyer" onclick="alert('Votre profil a ete enregistre');">
</td>
</tr>
<?php
}
?>
</table>
</form>
<?php |
Partager