Bonjour,

A travers un formulaire de réservation je voudrais rentrer les données saisies dans ce formulaire dans une de mes tables dans ma BDD.

J'ai deux petits problème liés à cette insertion, le premier résolvera d'ailleurs surement le deuxième.


Donc voila mon problème est le suivant :
J'aimerais pouvoir récupérer les num_formateur, coeff, type, et statut sans etre obligé d'afficher leur numero dans mes listes déroulante de ma page de reservation !


Code de la page réservation :

Code : 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
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
<FORM METHOD='POST' NAME='resa' id='resa' ACTION='resa_bdd.php'>
 
<table border=0 width='90%'>
  <tr>
	<td width='20%'>
	  <h6>Type : </h6>
		<blockquote>
			<SELECT NAME='type' id='type'>";
 
				$type = 'select num_type, nom_type from type_reservation order by num_type';
				$res = mysql_query($type);
				while($val=mysql_fetch_array($res))
				{
				echo '<option> '.$val['num_type'].' - '.$val['nom_type'].' </option>';
				}
 
echo "		</select>	
		</blockquote>
    </td>
  </tr>
  <tr>
	<td width='27%'>
	  <h6>Formateur : </h6>
		<blockquote>
			<SELECT NAME='formateur' id='formateur'>";
 
			$formateur = 'select num_formateur, nom_formateur, prenom_formateur from formateur order by num_formateur';
			$res = mysql_query($formateur);
			while($val=mysql_fetch_array($res))
			{
			echo '<option> '.$val['num_formateur'].' - '.$val['nom_formateur'].'&nbsp'.$val['prenom_formateur'].' </option>';
			}
 
echo "		</select>	
		</blockquote>
    </td>
	<td width='20%'>
	  <h6>Statut : </h6>
		<blockquote>
			<SELECT NAME='statut' id='statut'>";
 
			$statut = 'select num_statut, nom_statut from statut order by num_statut';
			$res = mysql_query($statut);
			while($val=mysql_fetch_array($res))
			{
			echo '<option> '.$val['num_statut'].' - '.$val['nom_statut'].' </option>';
			}
 
echo "		</select>	
		</blockquote>
    </td>
  </tr>
</table>
 
 
<table border=0 width='90%'>
 
  <tr>
 
    <td width='27%'>  
 
	  <h6>
	  <input type='radio' name='coeff' id='coeff' checked onClick='change()'/> Coefficient
	  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	  <input type='radio' name='coeff' id='autre' onClick='change()'/> Autre
	  </h6>
	    <blockquote><blockquote>
			<div class=tabCache id=coeff>
			<SELECT id='lstChamp' style='visibility:visible'>";
 
				$coeff = 'select num_coeff, valeur_coeff from coefficient order by num_coeff';
				$res = mysql_query($coeff);
				while($val=mysql_fetch_array($res))
				{
				echo '<option> '.$val['num_coeff'].' - '.$val['valeur_coeff'].' </option>';
				}
 
echo "		</select>
		</div>
		<div class=tabCache id=autre>
		<INPUT id='txtChamp' style='visibility:hidden' SIZE=3/>
		</div>
    </td>	
	<td width='20%'>
  <INPUT TYPE='submit' name='enregistrer' id='enregistrer' VALUE='Enregistrer'/>
  <INPUT type='hidden' name='afficher' id='afficher' value='ok'/>
 
</FORM>

Code de la page resa_bdd :

Code : 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?
$date = $_POST['date'];
$heure = $_POST['heure'];
$minute = $_POST['minute'];
$heure_duree = $_POST['heure_duree'];
$minute_duree = $_POST['minute_duree'];
$statut = $_POST['statut'];
$description = $_POST['description'];
$observation = $_POST['observation'];
$type = $_POST['type'];
$formateur = $_POST['formateur'];
$coeff = $_POST['coeff'];
 
if ($_POST['afficher']=="ok") {
 
	if (($date==""))
	{
 
		if($date=="") print("Veuillez saisir la date de la plage horaire<BR>\n");
 
	}
	else {
 
mysql_query("insert into reservation values ('','" . $_POST['date'] . "', '" . $_POST['heure'] . ':' . $_POST['minute'] . "','','" . $_POST['heure_duree'] . ':' . $_POST['minute_duree'] . "','" . $_SESSION['login'] . "','" . $_POST['observation'] . "','" . $_POST['description'] . "','" . $_POST['type'] . "','" . $_POST['formateur'] . "','" . $_POST['statut'] . "','" . $_POST['coeff'] . "') ");
 
echo "Récapitulatif des informations saisies :<BR><br>\n
	<UL>
	<LI>Formateur : $formateur</LI><br><br>
	<LI>Date : $date</LI><br><br>
	<LI>Heure : $heure:$minute</LI><br><br>
	<LI>Duree : $heure_duree:$minute_duree</LI><br><br>
	<LI>Statut : $statut</LI><br><br>
	<LI>Type : $type</LI><br><br>
	<LI>Coefficient : $coeff</LI><br><br>
	<LI>Description : $description</LI><br><br>
	<LI>Observation : $observation</LI><br><br>
	</UL>
	";
 
		  }
		  }
?>
( Je n'ai mis ici que les champs de saisies de mon formulaire qui me posais problème )

Merci d'avance !