Récupération de variable dans My_sql dans des

dirty_harry -  
 dirty_harry -
Bonjour,
Bonjour,

Je réalise actuellement un projet en PHP, mon script marche bien a l'exception d'un petit problème qui gâche tout: j'aimerais pour faire un formulaire sous forme de liste déroulante récupérer toute les entités d'une table, la requetes marches sans problèmes, lorsque je crée le formulaire sa marche toujours, mais lorsque je récupère la variable choisie je n'ai que le premier mot par exemple si je choisi dans la liste Clint Eastwood la variable $_POST vaudra: Clint, sa marche si je ne passe pas par une requète SQL mais je voudrais comprendre mon erreur, voila le code

<?php
//CONNECTION A MYSQL
mysql_connect("localhost", "user", "password");
mysql_select_db("maquette_refcost");
//REQUETTE
$resultattech=mysql_query("select NOMTECHNO from techno");
$technologie=array();
$i=0;
while($donneeTechno=mysql_fetch_array($resultattech))
{
$technologie[$i]=$donneeTechno['NOMTECHNO'];
$tech=$technologie[$i];
if ($i==0)
{
$optionTagstechno[$i]="<option value=$tech selected=selected/>$tech</option>";
}
else
{
$optionTagstechno[$i]="<option value=$tech />$tech</option>";
}
$i++;
}
$selectTechnoOptions=join("", $optionTagstechno);

?>
<label for=<?php echo 'techno'.$formulaire?>>Technologie </label> <select name=<?php echo 'techno'.$formulaire?> id =<?php echo 'techno'.$formulaire?>><?php echo $selectTechnoOptions;?></select>
<a href="index.php?action=ajoutTechno&donneeattente=attente" title="ajouter une technologie" class="adresse">+</a>

et pour la récupération:

<?php $techno=$_POST['techno'.$formulairePrecedent]; ?>

Merci d'avance

1 réponse

ben85350 Messages postés 622 Statut Membre 27
 
Salut !
Essai ceci :
$optionTagstechno[$i]="<option value='".$tech."' />$tech</option>"; 
0
dirty_harry
 
Désole de répondre en retard mais merci ta méthode marche impeccable.
0