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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
| <head>
<link href = "style.css" rel = "stylesheet" type = "text/css" />
</head>
<?php
require "bd-mysql.php";
$id = $_GET['id'];//on reprend la variable passée dans l'url
$req = mysql_query('SELECT * FROM projet WHERE nom_projet = "'.$id.'"');//on veut le nom du projet qui correspond à la ligne
$req2 = mysql_fetch_assoc($req);//on stock dans un tableau
$id_projet = $req2['id_projet'];//on affiche
?>
<div id="page">
<table><tbody>
<tr>
<td>
<?php
$reponse = mysql_query("SELECT * FROM projet WHERE id_projet = ".$id_projet."");
while ($aff = mysql_fetch_assoc($reponse)){
echo '<form action="?" method="post" name="nom_projet">
<span>Nom du projet: </span><input type="text" value="'.$aff['nom_projet'].'">
</form>';
echo '<form action="?" method="post" name="echeance_projet">
<span>Echéance du projet: </span><input type="text" value="'.$aff['echeance_projet'].'">
</form>';
echo '<form action="?" method="post" name="commentaire_projet">
<span>Commentaires du projet: </span><input type="text" value="'.$aff['commentaire_projet'].'">
</form>';
echo '<form action="?" method="post" name="etat_projet">
<span>Etat du projet: </span><input type="text" value="'.$aff['etat_projet'].'">
</form>';
}
?>
</td>
</tr>
<tr>
<td>
<?php
$reponse2 = mysql_query("SELECT * FROM client WHERE id_projet = ".$id_projet."");
while ($aff2 = mysql_fetch_assoc($reponse2)){
echo '<form action="?" method="post" name="nom_client">
<span>Nom du client: </span><input type="text" value="'.$aff2['nom_client'].'">
</form>';
echo '<form action="?" method="post" name="adresse_client">
<span>Adresse du client: </span><input type="text" value="'.$aff2['adresse_client'].'">
</form>';
echo '<form action="?" method="post" name="email_client">
<span>Email du client: </span><input type="text" value="'.$aff2['email_client'].'">
</form>';
echo '<form action="?" method="post" name="telephone_client">
<span>Telephone du client: </span><input type="text" value="'.$aff2['telephone_client'].'">
</form>';
echo '<form action="?" method="post" name="fax_client">
<span>Fax du client: </span><input type="text" value="'.$aff2['fax_client'].'">
</form>';
}
?>
</td>
</tr>
<tr>
<td>
<?php
$reponse = mysql_query("SELECT * FROM intervenant WHERE id_projet = ".$id_projet."");
while ($aff = mysql_fetch_assoc($reponse)){
echo '<form action="?" method="post" name="nom_intervenant">
<span>Nom de l\'intervenant: </span><input type="text" value="'.$aff['nom_intervenant'].'">
</form>';
echo '<form action="?" method="post" name="prenom_intervenant">
<span>Prenom de l\'intervenant: </span><input type="text" value="'.$aff['prenom_intervenant'].'">
</form>';
echo '<form action="?" method="post" name="telephone_intervenant">
<span>Telephone de l\'intervenant: </span><input type="text" value="'.$aff['telephone_intervenant'].'">
</form>';
echo '<form action="?" method="post" name="email_intervenant">
<span>Email de l\'intervenant: </span><input type="text" value="'.$aff['email_intervenant'].'">
</form>';
echo '<form action="?" method="post" name="societe_intervenant">
<span>Nom de la société intervenante: </span><input type="text" value="'.$aff['societe_intervenant'].'">
</form>';
}
?>
</td>
</tr>
<tr>
<td>
<?php
$reponse = mysql_query("SELECT * FROM contact WHERE id_projet = ".$id_projet."");
while ($aff = mysql_fetch_assoc($reponse)){
echo '<form action="?" method="post" name="nom_contact">
<span>Nom du contact: </span><input type="text" value="'.$aff['nom_contact'].'">
</form>';
echo '<form action="?" method="post" name="prenom_contact">
<span>Prenom du contact: </span><input type="text" value="'.$aff['prenom_contact'].'">
</form>';
echo '<form action="?" method="post" name="telephone_contact">
<span>Telephone du contact: </span><input type="text" value="'.$aff['telephone_contact'].'">
</form>';
echo '<form action="?" method="post" name="email_contact">
<span>Email du contact: </span><input type="text" value="'.$aff['email_contact'].'">
</form>';
}
?>
<?php
//pour mettre à jour la base de donnée
//je stock dans une variable les données présentes dans mes textbox
$nom_client = $_POST['nom_client'];
$adresse_client = $_POST['adresse_client'];
$email_client = $_POST['email_client'];
$telephone_client = $_POST['telephone_client'];
$fax_client = $_POST['fax_client'];
$nom_projet = $_POST['nom_projet'];
$echeance_projet = $_POST['echeance_projet'];
$commentaire_projet = $_POST['commentaire_projet'];
$etat_projet = $_POST['etat_projet'];
$nom_contact = $_POST['nom_contact'];
$prenom_contact = $_POST['prenom_contact'];
$telephone_contact = $_POST['telephone_contact'];
$email_contact = $_POST['email_contact'];
$nom_intervenant = $_POST['nom_intervenant'];
$prenom_intervenant = $_POST['prenom_intervenant'];
$tel_intervenant = $_POST['tel_intervenant'];
$email_intervenant = $_POST['email_intervenant'];
$societe_intervenant = $_POST['societe_intervenant'];
//j'exécute la requête
$rmajproj = mysql_query( "UPDATE projet SET
nom_projet = 'nom_projet'
commentaire_projet = 'commentaire_projet'
echeance_projet = 'echeance_projet'
etat_projet = 'etat_projet' ");
$rmajcli = mysql_query("UPDATE client SET
nom_client = 'nom_client'
adresse_client = 'adresse_client'
email_client = 'email_client'
telephone_client = 'telephone_client'
fax_client = 'fax_client'");
$rmajcontact = mysql_query"(UPDATE contact SET
nom_contact = 'nom_contact'
prenom_contact = 'prenom_contact'
telephone_contact = 'telephone_contact'
email_contact = 'email_contact'");
$rmajinter = mysql_query("UPDATE intervenant SET
nom_intervenant = 'nom_intervenant'
prenom_intervenant = 'prenom_intervenant'
telephone_intervenant = 'telephone_intervenant'
email_intervenant = 'email_intervenant'
societe_intervenant = 'societe_intervenant'");
//j'affiche la requête pour tester
?>
<form>
<input name='soumettre' type='submit' value='Envoyer'></td></tr>
</form>
</td>
</tr>
</tbody></table>
</div> |
Partager