Bonjour,

J'essaie de faire une fonction en lui passant 4 paramètres, j'aimerai savoir si cela est possible ?

Voici ma fonction :

Code php : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<?php
function Select($nomDuSelect, $table, $idDuChamp, $nomDuChamp)
{
	echo '<select name="' . $nomDuSelect . '" id="' . $nomDuSelect . '" style="width:140px">';
 
	$result = mysql_query("SELECT * FROM " . $table . "");
 
	while ($row = mysql_fetch_assoc($result))
	{
		echo '<option value="', $row['$idDuChamp'] , '" ';
 
		if($row['$nomDuChamp'] == $donnees['$nomDuChamp'])
		{
			echo 'selected="selected"';
		}
 
		echo ">" , $row['os_nom'] , "</option>";
	}
	echo'</SELECT>';
}
 
Select('inventaire_server_id_os', 'os', 'id_os', 'os_nom');
 
?>

Car avec cette fonction j'ai les valeur 'id_os', 'os_nom' qui ne passe pas. J'ai tester le script en renseignant dirrectement les variables et ca fonctionne...

Merci d'avance

Arnaud