| 12
 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
 
 | <?php
// connection bdd + variable
require('conf.php');
mysql_selectdb("$database") or die("Connexion impossible");
// déclaration requete sql
$query=mysql_query("SELECT `IdProduit`,`NomProduit`".   " FROM `Produit`".    " ORDER BY `NomProduit`");
$query2=mysql_query("SELECT `IdClient`,`NomClient`".   " FROM `Client`".    " ORDER BY `NomClient`");
?>
 
 
<!-----------------------/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\------------------------------>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Commande</title>
    </head>
 
    <body>
 
<script language="JavaScript" type="text/javascript">
<!--
var n = 0;
 
  function supprimer() {
    document.getElementById("Qté").removeChild(document.getElementById(n));
    n--;
  }
 
  function ajouter() {
    n++;
    var nouveauChampsTexte = document.createElement("input");
    var nouveauMaillon = document.getElementById("Qté").appendChild(nouveauChampsTexte);
    nouveauMaillon.type="text";
    nouveauMaillon.id=n;
    nouveauMaillon.name=n;
    nouveauMaillon.value=n
  }
//-->
</script>
 			</td>
			<td class="principal" width="273" height="106">  </td>
			</tr></table>
				<form method="post" name="nom" action="commande.php">
		<!--Date-->
				<fieldset>
       				<legend>Ajouter Une Commande</legend>
 
     			 			  <label for="Date">Date :</label>
      			 			<input type="text" name="Date" id="Date" placeholder="exemple: 06/05/2012" size="15" maxlength="10" />
 
 
 
       <!--------Liste déroulante Client----Client----client----client----client------------------------------------>
 
<?
echo('<select name="Client" id="Client">');
 
if($Client=="")
{
echo('<option value="'.'">'.'< Choisir Client >'.'</option>');
}
 
else
 
{
echo('<option value="'.'">'.'</option>');
}
 
 
 
while ($ligne2=mysql_fetch_object($query2)){
//la concatenation des champs se fait ici
echo('<option>'.$ligne2->NomClient.'</option>'); }
 
 
echo('</select>');
?>
 
       <!-------------fin liste client------------------------------------------------------------------------------>
<br />
 
 
 
   			 			<p>
     			 			  <label for="Montant Total">Montant Total :</label>
      			 			<input type="text" name="Montant Total" id="Montant_Total" placeholder="exemple: 1500" size="30" maxlength="10" />
    						</p>
 
 
 
 
<fieldset>
<br />
 
<!-- Liste déroulante____________PRODUIT_________****************************************************************____________________________-->
 
 
 
<?
echo('<select name="Produit" id="Produit">');
 
if($produit=="")
{
echo('<option value="'.'">'.'< Choisir Produit >'.'</option>');
}
 
else
 
{
echo('<option value="'.'">'.'</option>');
}
 
 
 
while ($ligne1=mysql_fetch_object($query)){
//la concatenation des champs se fait ici
echo('<option>'.$ligne1->NomProduit.'</option>'); }
 
 
echo('</select>');
?>
 
 
     			 			  <label for="Qté">Qté :</label>
      			 			<input type="text" name="Qté" id="Qté" placeholder="exemple: 10" size="10" maxlength="10" />
 
<br/>
 
<input type="button" value="+" onclick="ajouter();" />
<input type="button" value="-" onclick="supprimer();" />
 
<span id="Qté"></span>
 
</tr>
</table>
</form>
<!------------------------------------------------------------------------------->
<br /><input type="submit" name="ok" id="ok" value="Envoyer" />
 
<?php
 
if(isset($_POST['ok']) && isset($_POST['Produit']) && $_POST['Produit'] != "")
 
{
 
    $Produit_selected = $_POST['Produit'];
 
    $date_selected = $_POST['Date'];
$client_selected = $_POST['Client'];
$Montant_Total_selected = $_POST['Montant_Total'];
$montantpluscent=$Montant_Total_selected + 100;
$Qte_selected = $_POST['Qté'];
echo "Date $date_selected  \n Client $client_selected \n produit  $Produit_selected \n Qté $Qte_selected     montant:$Montant_Total_selected montant plus cent $montantpluscent" ;
?>
 
<?php
 
}
 
?>	
 
<? 
/////////:$query = "INSERT INTO Client VALUES ('','$NomClient','$Adresse')";
/////////			mysql_query($query);
?>
 
 
<?
// fermeture de la base pour eviter les problèmes
mysql_close();
?>
    </body>
</html> | 
Partager