erreur T_else

Eléphant du PHP | 260 Messages

23 juin 2005, 11:02

Tiens essaye sa et dis moi :
<body> 
<?php 

$host = '****'; 
$user = '****'; 
$pass = '***'; 
$db = '***'; 

// connection à la DB 
$link = mysql_connect ($host,$user,$pass) or die ('Erreur : '.mysql_error() ); 
mysql_select_db($db) or die ('Erreur :'.mysql_error()); 

$id =$_GET['id']; 

$select = "SELECT * FROM produit2 WHERE reference LIKE '$id'"; 
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() ); 
$row = mysql_fetch_assoc($result); 

$nom = 'nom'; 
$formule = 'formule'; 
$reference = 'reference'; 
$num = $row['numero_cass']; 
$nom1 = $row['nom']; 

if(isset($_POST['envoi'])) 
{ 
	$quantite=$_POST['quantite']; 
	$fournisseur = $_POST['fournisseur']; 
	$nombre_quantite=$_POST['nombre_quantite']; 
	$prix=$_POST['prix']; 
	$date = date("d-m"); 

	if (($prix == '') || ($nombre_quantite == '') || ($quantite == '') || ($fournisseur == ''))
	{ 
		?> 
						<h3>Informations incomplètes</h3> 
						<p>Un (ou plusieurs) champ(s) n'a(ont) pas été correctement rempli(s).</p> 
				<ol>
		<?php 
						if ($prix == '') // Si le champ "prix" est vide, 
							{
								print "<li>Vous n'avez pas précisé le prix de la molecule</li>\n";
							} 
						if ($quantite == '') // Si le champ "quantite" est vide, 
							{
								print "<li>Vous n'avez pas précisé la quantite de molecule par lot</li>\n";
							} 
						if ($nombre_quantite == '') // Si le champ "nombre_quantite" est vide, 
							{
								print "<li>Vous n'avez pas précisé le nombre de lot de molecule a commander</li>\n";
							} 
						if ($fournisseur == '')  // Si le champ "fournisseur" est vide, 
							{
								print "<li>Vous n'avez pas précisé le fournisseur pour ce produit</li>\n";
							} 
		?> 
				</ol>
		
		
		<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post"> 
		  <table summary=""> 
			<col width="250" title="titres" /> 
			<col width="15" title="oblige" /> 
			<col width="250" title="donnees" /> 
		<tr width="30%" height="15"><td><b>Nom de la molécule :</td> 
		<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
		<td><b><?php print $nom1; ?></b></td></tr> 
		<tr width="30%" height="29"><td><b>Formule brute de la molecule:</td> 
		<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
		<td><b><?php print $row['formule']; ?></b></td></tr> 
		<tr width="30%" height="29"><td><b>Localisation de la Molécule:</td> 
		<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
		<td><b><?php print $row['localisation']; ?></b></td></tr> 
		<tr width="30%" height="29"><td><b>Disponibilité :</b></td> 
		<td><div style="color: #ffffff; text-align: center; font-weight: bold"></div></td> 
		<td><b><?php print $row['disponibilite']; ?></b></td></tr> 
		<tr width="30%" height="15"><td><b>Quantité en reserve :</td> 
		<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
		<td><b><?php print $row['quantite']; ?></b></td></tr> 
		<tr width="30%" height="29"><td><b>Reference de la molecule:</td> 
		<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
		<td><b><?php print $row['reference']; ?></b></td></tr> 
		<tr width="30%" height="29"><td><b>Numero de CAS:</td> 
		<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
		<td><b><?php print $row['numero_cass']; ?></b></td></tr> 
		<tr width="30%" height="29"><td><b>Toxicite :</b></td> 
		<td><div style="color: #ffffff; text-align: center; font-weight: bold"></div></td> 
		<td><b><?php print $row['toxicite']; ?></b></td></tr> 
		
		<tr width="30%" height="29"><td><b>Fournisseur:</td> 
		<td><div style="color: #ff0000; text-align: center; font-weight: bold">*</div></td> 
		<td width="30%" height="29"><select name="fournisseur"> 
		<option value="acros">Acros</option> 
		<option value="aldricht">Aldricht</option> 
		<option value="sigma">Sigma</option> 
		<option value="lancaster">Lancaster</option> 
		<option value="sigma">Fluka</option> 
		<option value="lancaster">Strem</option> 
		<option value="autres">autres</option> 
		</select></td> 
		<tr width="30%" height="29"><td><b>Autres Fournisseur:</td> 
		<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
		<td><b><input type="text" name="nouveau_fournisseur"></b></td></tr> 
		<tr width="30%" height="29"><td><b>Quantité unitaire :</b></td> 
		<td><div style="color: #ffffff; text-align: center; font-weight: bold">*</div></td> 
		<td><b><input type="text" name="quantite"></b></td></tr> 
		<tr width="30%" height="29"><td><b>Nombres d'unités:</td> 
		<td><div style="color: #ff0000; text-align: center; font-weight: bold">*</div></td> 
		<td><b><input type="t 2000 ext" name="nombre_quantite"></b></td></tr> 
		<tr width="30%" height="29"><td><b>Prix unitaire :</b></td> 
		<td><div style="color: #ffffff; text-align: center; font-weight: bold">*</div></td> 
		<td><b><input type="text" name="prix">€</b></td></tr> 
		
		<tr><td colspan="3"><div style="text-align:center;"><input type="submit" class="verif" name="envoi" value="Envoyer" />&nbsp; 
		<input type="reset" class="verif" value="Tout effacer" /><input type="submit" value="Imprimer" onclick="print();"></div></td></tr> 
		
		</TABLE></form> 
		<?php         
	} 
	else 
	{ 
	
			print "<h3>Merci ! Voici les informations que vous avez fournies</h3>\n"; 
			print "<p>Informations sur la nouvelle molecule:</p>\n"; 
			print "<b>Son nom :</b>".$nom."<br />\n"; 
			print "<b>Sa formule Brute :</b>".$formule."<br />\n"; 
			print "<b>Sa localisation :</b>".$localisation."<br />\n"; 
			print "<b>Sa quantite en reserve :</b>".$quantite."<br />\n"; 
			print "<b>Sa reference :</b>".$reference."<br />\n"; 
			print "<b>Son numero de CAS :</b>".$numero_cass."<br />\n"; 
			if ($toxicite !=='')
			{ 
				print "<b>Sa toxicite s'il y en a une :</b> ".$toxicite."<br />\n"; 
			} 
			print "<b>Son fournisseur :</b>".$fournisseur."<br />\n"; 
			print "<b>Sa Quantité unitaire :</b>".$quantite."<br />\n"; 
			print "<b>Le nombre d'unité a commander :</b>".$nombre_quantite."<br />\n"; 
			print "<b>Son Prix :</b>".$prix."<br />\n";         
			print("<p>Retour vers l'index de recherche, cliquez <a href=\"recherche.php\" title=\"Retour vers le formulaire de recherche\">ICI</a></p>"); 
			print("<p>Retour vers l'Index, cliquez <a href=\"index.html\" title=\"Retour a l'index\">ICI</a></p>"); 
					 
		
		$host = '***'; 
		$user = '***'; 
		$pass = '***'; 
		$db = '***'; 
		
		// connection à la DB 
		$link = mysql_connect ($host,$user,$pass) or die ('Erreur : '.mysql_error() ); 
		mysql_select_db($db) or die ('Erreur :'.mysql_error()); 
		
		$fournisseur=''; 
		if(isset($_POST['nouveau_fournisseur']))
		{ 
			if(strcmp($_POST['nouveau_fournisseur'],'')!=0)
			{ 
				$fournisseur=$_POST['nouveau_fournisseur']; 
			}else{ 
				$fournisseur=$_POST['fournisseur']; 
			} 
		} 
		
		
		
		
		$select2 = "SELECT * FROM produit2 WHERE reference LIKE '$id'"; 
		$result2 = mysql_query($select2,$link) or die ('Erreur : '.mysql_error() ); 
		$row2 = mysql_fetch_assoc($result2); 
		$nom2 = $row2['nom']; 
		$numero_cass2 = $row2['numero_cass']; 
		
		
		$fournisseur = addslashes($fournisseur); 
		$quantite = addslashes($quantite); 
		$nombre_quantite= addslashes($nombre_quantite); 
		$prix= addslashes($prix); 
		$numero_cass2= addslashes($numero_cass2); 
		$nom2= addslashes($nom2); 
		$date= addslashes($date); 
		
		if(($quantite !="")&&($prix !="")&&($nombre_quantite !="")) 
		{ 
			$query="INSERT INTO commande (fournisseur,quantite,nombre_quantite,prix,numero_cass,nom,date) VALUES ('".$fournisseur."', '".$quantite."', '".$nombre_quantite."', '".$prix."','".$numero_cass2."','".$nom2."','".$date."');"; 
			mysql_query($query) or die (mysql_error); 
		} 
	} 
}
else 
{
	
	?> 
	<H3><strong>Formulaire de commande de produits</strong></H3> 
	<p>Notez que les champs précédés d'une <span style="color: #ff0000; text-align: center; font-weight: bold">*</span> doivent obligatoirement être remplis.</p> 
	<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post"> 
	  <table summary=""> 
		<col width="250" title="titres" /> 
		<col width="15" title="oblige" /> 
		<col width="250" title="donnees" /> 
	<tr width="30%" height="15"><td><b>Nom de la molécule :</td> 
	<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
	<td><b><?php print $nom1; ?></b></td></tr> 
	<tr width="30%" height="29"><td><b>Formule brute de la molecule:</td> 
	<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
	<td><b><?php print $row['formule']; ?></b></td></tr> 
	<tr width="30%" height="29"><td><b>Localisation de la Molécule:</td> 
	<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
	<td><b><?php print $row['localisation']; ?></b></td></tr> 
	<tr width="30%" height="29"><td><b>Disponibilité :</b></td> 
	<td><div style="color: #ffffff; text-align: center; font-weight: bold"></div></td> 
	<td><b><?php print $row['disponibilite']; ?></b></td></tr> 
	<tr width="30%" height="15"><td><b>Quantité en reserve :</td> 
	<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
	<td><b><?php print $row['quantite']; ?></b></td></tr> 
	<tr width="30%" height="29"><td><b>Reference de la molecule:</td> 
	<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
	<td><b><?php print $row['reference']; ?></b></td></tr> 
	<tr width="30%" height="29"><td><b>Numero de CAS:</td> 
	<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
	<td><b><?php print $row['numero_cass']; ?></b></td></tr> 
	<tr width="30%" height="29"><td><b>Toxicite :</b></td> 
	<td><div style="color: #ffffff; text-align: center; font-weight: bold"></div></td> 
	<td><b><?php print $row['toxicite']; ?></b></td></tr> 
	
	<tr width="30%" height="29"><td><b>Fournisseur:</td> 
	<td><div style="color: #ff0000; text-align: center; font-weight: bold">*</div></td> 
	<td width="30%" height="29"><select name="fournisseur"> 
	<option value="acros">Acros</option> 
	<option value="aldricht">Aldricht</option> 
	<option value="sigma">Sigma</option> 
	<option value="lancaster">Lancaster</option> 
	<option value="sigma">Fluka</option> 
	<option value="lancaster">Strem</option> 
	<option value="autres">autres</option> 
	</select></td> 
	<tr width="30%" height="29"><td><b>Autres Fournisseur:</td> 
	<td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td> 
	<td><b><input type="text" name="nouveau_fournisseur"></b></td></tr> 
	<tr width="30%" height="29"><td><b>Quantité unitaire :</b></td> 
	<td><div style="color: #ffffff; text-align: center; font-weight: bold">*</div></td> 
	<td><b><input type="text" name="quantite"></b></td></tr> 
	<tr width="30%" height="29"><td><b>Nombres d'unités:</td> 
	<td><div style="color: #ff0000; text-align: center; font-weight: bold">*</div></td> 
	<td><b><input type="text" name="nombre_quantite"></b></td></tr> 
	<tr width="30%" height="29"><td><b>Prix unitaire :</b></td> 
	<td><div style="color: #ffffff; text-align: center; font-weight: bold">*</div></td> 
	<td><b><input type="text" name="prix">€</b></td></tr> 
	
	<tr><td colspan="3"><div style="text-align:center;"><input type="submit" class="verif" name="envoi" value="Envoyer" />&nbsp; 
	<input type="reset" class="verif" value="Tout effacer" /><input type="submit" value="Imprimer" onclick="print();"></div></td> 1d7f </tr> 
	
	</TABLE></form> 
	
	<?php 
} 
?> 
</BODY> 
Mon jeu : http://www.battle-stars.fr.tc
---
Mon serveur : http://servlan.dyndns.org
---
Bientôt tous mes serveurs OPEN ;)

Modérateur PHPfrance
Modérateur PHPfrance | 6373 Messages

23 juin 2005, 11:05

ok je retire ma suggestion apparament j'ai mal lu désolé :oops:

Eléphant du PHP | 450 Messages

23 juin 2005, 11:08

Lol waf_wafe sa marche nickel encore merci :) :lol:

ps : ta changé quoi ??:lol: :lol:

(ouckileou Merci quand meme :wink: )
Alone in the dark , I smile :D

Eléphant du PHP | 260 Messages

23 juin 2005, 11:12

Alors pour commencer j'ai refait toute l'indentation :evil:
Ensuite, j'ai chercher les erreurs de point-virgules :shock:
Enfin, j'ai ajouter ou supprimer les accolades en trop ou manquantes 8)

Toujours No Comment et boulet le Waf ??
:wink:
Mon jeu : http://www.battle-stars.fr.tc
---
Mon serveur : http://servlan.dyndns.org
---
Bientôt tous mes serveurs OPEN ;)

Eléphant du PHP | 260 Messages

23 juin 2005, 11:13

ok je retire ma suggestion apparament j'ai mal lu désolé :oops:
Je te rassure c'est ce que j'ai crus la première fois ! :lol:
Mon jeu : http://www.battle-stars.fr.tc
---
Mon serveur : http://servlan.dyndns.org
---
Bientôt tous mes serveurs OPEN ;)

Eléphant du PHP | 450 Messages

23 juin 2005, 11:33

Franchement merci :)

voili voilou :)
a bientot dans de nouvelles et fantastiques aventure sur les rives du php :lol: :lol:

(qui ne serait tarder dailleurs :) lol)
Alone in the dark , I smile :D

Invité
Invité n'ayant pas de compte PHPfrance

23 juin 2005, 11:39

c'est qui saucice castelli? :evil:

Eléphant du PHP | 450 Messages

23 juin 2005, 11:41

hiihihihi :lol: :lol: :lol:

J'en ais absolument aucune idé :P :P
Alone in the dark , I smile :D

Eléphant du PHP | 419 Messages

23 juin 2005, 11:42

désolé pas connecter

Eléphant du PHP | 419 Messages

23 juin 2005, 11:43

sausee ça vient pas de saucisse ça vient kaiser sausee d'usual suspect

Eléphant du PHP | 450 Messages

23 juin 2005, 11:47

A wai c pas vraiment la meme classe directement :)
hihi

en tout cas Merci a toi SAUSEE2005

:oops: C'est mieu comme sa :oops: lol
Alone in the dark , I smile :D