bonsoir a vous tous,
je suis débutante en php ,j'arrive pas a inséré pour un REF un type verre1 ou un type verre 2 et un type PVB
y'a t'il quelqu un pour voir ou est le probleme dans mon code merci d'avance

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
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php
$server = '';
$database = ''; 
$user = '' ; 
$password = '' ;  
 
if (!($connection =  odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$database;", $user, 
 
$password,SQL_CUR_USE_ODBC)))
  {exit("echec de connection");}
 
// insetion 
 if(isset($_POST['button']))
{
if( isset($_POST))
{
 
 
 
 
 
$requete3="SELECT distinct DESIGNATION, famille
 FROM [REPORTIVE].[dbo].[produit_finis_pvb_v1_v2] where REF like '".$_POST['REF']."'";
  $statement3 = odbc_exec ($connection, $requete3);
  if(!$statement3)   { echo "echec de oci_parse"; }
  while (odbc_fetch_into ($statement3, $val3))
{
	$design=$val3[0];
}}
else 
{
	$design=$_POST['REF'];
$statement3 = odbc_exec ($connection, $requete3);
if(!$statement3)   { echo "echec de oci_parse"; }
else { 
while(odbc_fetch_into ($statement3, $val3))
 
odbc_free_result($statement3);} 
 
 
$requete="INSERT INTO [REPORTIVE].[dbo].[produit_finis_pvb_v1_v2]
      ([REF]
	  , [DESIGNATION]
      ,[TYPE DE VERRE 1]
      ,[TYPE DE VERRE 2]
      ,[TYPE DE PVB])
     VALUES
           (
           '".$_POST['REF']."
		   ,'".$design."'
		   ,'".$design11."'
		   ,".$_POST['TYPE DE VERRE 1']."
		   ,".$_POST['TYPE DE VERRE 2']."
		   ,".$_POST['TYPE DE PVB'].")";
 
$statement = odbc_exec ($connection, $requete);
if(!$statement)  { echo "echec de oci_parse";}
else {odbc_free_result($statement);
odbc_close($connection); } }
}
else{
echo "erreur";
}
/*CONVERT(TEXT,[famille])*/
//ligne du tableau
 
$query="SELECT distinct[REF]
      ,[famille]
      ,[Designation]
      ,[TYPE DE VERRE 1]
      ,[TYPE DE VERRE 2]
      ,[TYPE DE PVB]
  FROM [REPORTIVE].[dbo].[produit_finis_pvb_v1_v2]
";
 
 
$query7="SELECT [ARTICLE]
       
  FROM [REPORTIVE].[dbo].[REFERENCE.ARTICLES.VERRE]
  where FILIERE IN ( 'LVC', 'LVF')";
 
  $statement7 = odbc_exec ($connection, $query7);
if(!$statement7)   echo "echec de oci_parse de query7 ";
 
 
?>
 
 
 
<body>
<p>&nbsp;</p>
<div align="center">
  <table width="495" height="79" border="1">
    <tr>
      <th width="691" scope="col"><div align="center"><img src="MFG_LOGO_COULEURS_CMJN.png" width="312" height="312"></div></th>
    </tr>
  </table>
</div>
<p>&nbsp;</p>
<form method="post" action="">
<table width="404" border="1"align="center">
 
  <tr>
    <th scope="row">REF</th>
    <td><div align="left">
      <!--<input type="text" name="ARTICLE" id="article">-->
      <select name="REF" id="REF">
        <?php while (odbc_fetch_into ($statement7, $val7))
{  ?>
        <option value="<?=$val7[0]?>">
          <?=$val7[0]?>
          </option>
        <?php }   
   odbc_free_result($statement7);
  ?>   
 
      </select>
    </div></td>
  </tr> 
 <?php $query7="SELECT [ARTICLE]
      
    FROM [REPORTIVE].[dbo].[REFERENCE.ARTICLES.VERRE]
  
  ";
 
  $statement7 = odbc_exec ($connection, $query7);
if(!$statement7)   echo "echec de oci_parse de query7 ";
?>
 
  <tr>
    <th scope="row">TYPE DE VERRE 1</th>
    <td><div align="left">
      <!--<input type="text" name="ARTICLE" id="article">-->
      <select name="TYPE DE VERRE 1" id="TYPE DE VERRE 1">
        <?php while (odbc_fetch_into ($statement7, $val7))
{  ?>
        <option value="<?=$val7[0]?>">
          <?=$val7[0]?>
          </option>
        <?php }   
   odbc_free_result($statement7);
  ?>   
      </select>
    </div></td>
  </tr>
  <?php $query7="SELECT [ARTICLE]
    
  FROM [REPORTIVE].[dbo].[REFERENCE.ARTICLES.VERRE]";
 
  $statement7 = odbc_exec ($connection, $query7);
if(!$statement7)   echo "echec de oci_parse de query7 ";
?>
  <tr>
    <th scope="row">TYPE DE VERRE 2</th>
    <td><div align="left">
      <!--<input type="text" name="ARTICLE" id="article">-->
      <select name="TYPE DE VERRE 2" id="TYPE DE VERRE 2">
        <OPTION></OPTION>
        <?php while (odbc_fetch_into ($statement7, $val7))
{  ?>
        <option value="<?=$val7[0]?>">
          <?=$val7[0]?>
          </option>
        <?php }   
   odbc_free_result($statement7);
  ?> 
 
      </select>
    </div></td>
  </tr>
 
 
  <tr>
    <th width="156" scope="col">TYPE DE PVB</th>
    <th width="90" scope="col"><label for="textfield"></label>
      <div align="left">
        <input type="text" name="TYPE DE PVB" id="TYPE DE PVB">
 
      </div>
  </tr>
 
  <tr>
    <th scope="row">&nbsp;</th>
    <td><div align="left">
      <input name="button" type="submit" id="button" value="Inserer">
    </div></td>
  </tr>
</table>
<p>&nbsp;</p>
<table width="467" height="55" border="1"align="center">
  <tr>
    <th width="149" scope="col">REF</th>
    <th width="149" scope="col">FAMILLE</th>
    <th width="147" scope="col">DESIGNATION</th>
    <th width="147" scope="col">TYPE DE VERRE1</th>
    <th width="147" scope="col">TYPE DE VERRE2</th>
    <th width="147" scope="col">TYPE DE PVB</th>
  </tr>
<?php 
$statement = odbc_exec ($connection, $query);
if(!$statement)   echo "echec de oci_parse";
while (odbc_fetch_into ($statement, $val))
{  ?>
  <tr>
    <td><?php echo $val[0]; ?></td>
    <td><?php echo $val[1]; ?></td>
    <td><?php echo $val[2]; ?></td>
    <td><?php echo $val[3]; ?></td>
    <td><?php echo $val[4]; ?></td>
    <td><?php echo $val[5]; ?></td>
   </tr>
 
  <?php } 
odbc_free_result($statement);
odbc_close($connection);
  ?>
 
</table>
</body>
</form>