Paramètrer ma requete après sélection dans un formulaire
Bonjour.
Je voudrais récupérer les données d'un membre lorsqu'il est sélectionné dans on controle select.
Je donne tout le script de la page car je ne sais pas :
- Où mettre la requete,
- paramétrer la clause Where
Code:
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
| <?php
require('connect.php');
require('fns_validation.php');
if(isset($_POST['nom'])) $nom=$_POST['nom'];
else $nom="";
if(isset($_POST['prenom'])) $prenom=$_POST['prenom'];
else $prenom="";
if(isset($_POST['profession'])) $profession=$_POST['profession'];
else $profession="";
if(isset($_POST['societe'])) $societe=$_POST['societe'];
else $societe="";
if(isset($_POST['adresse'])) $adresse=$_POST['adresse'];
else $adresse="";
if(isset($_POST['codep'])) $codep=$_POST['codep'];
else $codep="";
if(isset($_POST['ville'])) $ville=$_POST['ville'];
else $ville="";
if(isset($_POST['telephone'])) $tel=$_POST['telephone'];
else $tel="";
if(isset($_POST['fax'])) $fax=$_POST['fax'];
else $fax="";
if(isset($_POST['email'])) $email=$_POST['email'];
else $email="";
if(isset($_POST['date_abo'])) $date_abo=$_POST['date_abo'];
else $date_abo="";
if(isset($_POST['codeperso'])) $codeperso=$_POST['codeperso'];
else $codeperso="";
?>
<diV align="center">
<form name="modifier" method="POST">
<table bgcolor='#cccccc' border="1" style="margin-top:30px">
<colgroup width=180>
<colgroup width=380>
<tr>
<td class="tdct" colspan="2" style="height:40px"><b> Modifier les données d'un abonné</b> </td>
</tr>
<tr>
<td class="tdct" colspan="2">
<SELECT name="membre" style="width:300px">
<OPTION value=""></OPTION>
<?php
$result_sql = mysql_query('Select * From r2sadmin Order by nom, prenom',$connexion);
while ($row = mysql_fetch_array($result_sql))
{
?>
<option value='<?php echo $row['id_abonne']?>'><?php echo $row['code_perso']; echo ", "; echo $row['nom']; echo ", "; echo $row['prenom'] ?></option>
<?
}
echo '</select>';
?>
</td>
<tr>
<td class="tdrg">Nom * :</td><td> <input type="text" name="nom" value="<?php echo $nom;?>" style="height:20px; width=200px" onblur="javascript:this.value=this.value.toUpperCase();"></td>
</tr>
<tr>
<td class="tdrg">Prenom * :</td><td> <input type="text" name="prenom" value="<?php echo $prenom;?>" style="height:20px; width=200px"></td>
</tr>
<tr>
<td class="tdrg">Profession :</td><td> <input type="text" name="profession" value="<?php echo $profession;?>" style="height:20px; width=200px"></td>
</tr>
<tr>
<td class="tdrg">Organisme ou entreprise :</td><td> <input type="text" name="company" value="<?php echo $societe;?>" style="height:20px; width=350px"></td>
</tr>
<tr>
<td class="tdrg">Adresse * :</td><td> <input type="text" name="adresse" value="<?php echo $adresse;?>" style="height:20px; width=350px"></td>
</tr>
<tr>
<td class="tdrg">Code postal * :</td><td> <input type="text" name="codep" value="<?php echo $codep;?>" style="height:20px; width=60px">
<font face="verdana"; size=2> Ville * : <input type="text" name="ville" value="<?php echo $ville;?>" style="height:20px; width=185px" onblur="javascript:this.value=this.value.toUpperCase();"></td>
</tr>
<tr>
<td class="tdrg">Téléphone :</td><td> <input type="text" name="telephone" value="<?php echo $tel;?>" style="height:20px; width=100px">
<font face="verdana"; size=2> Fax <font color="#cccccc">* </font>: <input type="text" name="fax" value="<?php echo $fax;?>" style="height:20px; width=100px"></td>
</tr>
<tr>
<td class="tdrg">Email * :</td><td> <input type="text" name="email" value="<?php echo $email;?>" style="height:20px; width=350px"></td>
</tr>
<tr>
<td class="tdrg">Date d'abonnement * :</td><td> <input onclick="ds_sh(this);" name="date" style="cursor: text; width:100px" /></td></tr>
<tr>
<td class="tdrg">Code personnel * :</td><td> <input type="text" name="codeperso" value="<?php echo $codeperso;?>" style="height:20px; width=100px"></td>
</tr>
<tr>
<td class="tdct" colspan="2" style="height:30px"><font color="red">Les zones marquées d'une * sont obligatoires.</td>
</tr>
<tr>
<td align="center" colspan="2" style="height:40px"><input type="reset" name="effacer" value="Annuler la saisie" style="width=160px"> <input type="submit" name="nouveau" value="Enregistrer l'abonné"></td>
</tr>
</table>
</div>
</form> |
Merci d'avance