j'ai travailler sur une page qui permet d'inserer des nouveaux articles sur un site de vente et lorsque j'envoi ma requete tout se passe presque bien la seule chose qui ne va pas est que je n'arrive pas a afficher les images sur la page de destination
Je suis presque certain que ca ne dois pas etre grand chose mais etant encore novice dans le php je ne vois pas
Pourriez vous m'aider svp
voici la page par laquelle j'inserre mes nouveaux produits
<?php
{
if($_POST) // vérifie si le tableau post existe
{
if($_POST['envoyer']) // Vérifie si le fichier a été validé
{
echo'
<div class="Body">
';
include("menu/menu_Admin.inc.php");
echo'
<div STYLE="margin-left:50px;margin-top:50px;width:400px;border:1px solid #d0d0d0;">
';
if(is_uploaded_file($_FILES['ImgG']['tmp_name']))
{
echo "Le fichier ".$_FILES['ImgG']['name']." a bien été téléchargé<br>";
echo "Il fait ".$_FILES['ImgG']['size']." et est de type ".$_FILES['ImgG']['type']."<br>";
}
else
{
echo "Le fichier ".$_FILES['ImgG']['name']." n'a pas été téléchargé<br>";
}
if(is_uploaded_file($_FILES['ImgP1']['tmp_name']))
{
echo "Le fichier ".$_FILES['ImgP1']['name']." a bien été téléchargé<br>";
echo "Il fait ".$_FILES['ImgP1']['size']." et est de type ".$_FILES['ImgP1']['type']."<br>";
}
else
{
echo "Le fichier ".$_FILES['ImgP1']['name']." n'a pas été téléchargé<br>";
}
if(is_uploaded_file($_FILES['ImgP2']['tmp_name']))
{
echo "Le fichier ".$_FILES['ImgP2']['name']." a bien été téléchargé<br>";
echo "Il fait ".$_FILES['ImgP2']['size']." et est de type ".$_FILES['ImgP2']['type']."<br>";
}
else
{
echo "Le fichier ".$_FILES['ImgP2']['name']." n'a pas été téléchargé<br>";
}
if(is_uploaded_file($_FILES['ImgP3']['tmp_name']))
{
echo "Le fichier ".$_FILES['ImgP3']['name']." a bien été téléchargé<br>";
echo "Il fait ".$_FILES['ImgP3']['size']." et est de type ".$_FILES['ImgP3']['type']."<br>";
}
else
{
echo "Le fichier ".$_FILES['ImgP3']['name']." n'a pas été téléchargé<br>";
}
echo'
</div></div>
';
}
}
// ============== recherche du prochain ID_Prod ==============
include("tools/db_con.inc.php");
$sql='SELECT ID_Products FROM `tb_products`';
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$result=mysql_query($sql,$db);
$num_rows=mysql_num_rows($result);
$ID_P=$num_rows+1;
// ===========================================================
if(isset($_POST['Desc_fr']))
{
$Desc_fr=$_POST['Desc_fr'];
}
else
{
echo' Veuillez entrer le titre Français, merci!';
}
if(isset($_POST['Titre_fr']))
{
$Titre_fr=$_POST['Titre_fr'];
}
else
{
echo' Veuillez entrer le titre Français, merci!';
}
if(isset($_POST['Titre_en']))
{
$Titre_en=$_POST['Titre_en'];
}
else
{
echo' Veuillez entrer le titre Anglais, merci!';
}
if(isset($_POST['Categorie']))
{
$Categorie=$_POST['Categorie'];
}
else
{
echo' Veuillez sélectionner une catégorie, merci!';
}
if(isset($_POST['Prix']))
{
$Prix=$_POST['Prix'];
}
else
{
echo' Veuillez introduire un prix pour cet article, merci!';
}
if(isset($Desc_fr) && isset($Titre_fr) && isset($Titre_en))
{
include("tools/db_con.inc.php");
$sql='INSERT INTO `tb_products` (ID_Products,Categorie,Titre_fr,Titre_en,Description_fr,Description_en,Prix,ImgG,ImgP1,ImgP2,ImgP3) Values ("","'.$Categorie.'","'.$Titre_fr.'","'.$Titre_en.'","'.$Desc_fr.'","'.$Desc_en.'","'.$Prix.'","'.$ImgG.'","'.$ImgP1.'","'.$ImgP2.'","'.$ImgP3.'")';
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
echo " La table Produits a bien été remplie, voici les informations:";
$sql = "SELECT * FROM `tb_products` WHERE ID_Products=$ID_P" ;
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$result=mysql_query($sql,$db);
While($row=mysql_fetch_array($result))
{
echo'
<div STYLE="">
<table cellspacing="0" cellpadding="0" border="0" width="200">
<tr>
<td colspan="3">'.$row['Titre_fr'].'</td>
</tr>
<tr>
<td colspan="3">'.$row['Description_fr'].'</td>
</tr>
<tr>
<td colspan="3"><img src="Products/'.$row['ID_Products'].'/'.$row['ImgG'].'" width="120" height="120" border="0"/></td>
</tr>
<tr>
<td><img src="Products/'.$row['ID_Products'].'/'.$row['ImgP1'].'" width="50" height="50" border="0"/></td>
<td><img src="Products/'.$row['ID_Products'].'/'.$row['ImgP2'].'" width="50" height="50" border="0"/></td>
<td><img src="Products/'.$row['ID_Products'].'/'.$row['ImgP3'].'" width="50" height="50" border="0"/></td>
</tr>
<tr>
<td colspan="3">Prix : '.$row['Prix'].' €</td>
</tr>
</table>
</div>
';
}
}
else
{
echo " La table Produits n'a pas été remplie";
}
echo'
<div class="Body">
';
include("menu/menu_Admin.inc.php");
echo'
<br><br>
<div class="Add_News">
<table cellpadding="0" cellspacing="0" border="0" width="515">
<tr>
<td>
<div STYLE="margin-bottom:-5px;font-size:12px;">
<table cellpadding="0" cellspacing="0" border="0" width="515">
<td width="6" align="left">
<img src="pictures/Dep_tl.bmp" width="6" height="34" border="0" />
</td>
<td width="188" align="left">
<img src="pictures/Dep_t.bmp" width="300" height="34" border="0" />
</td>
<td width="19" align="left">
<img src="pictures/Dep_b_txt.bmp" width="19" height="34" border="0" />
</td>
<td width="183" STYLE="color:#fff;font-weight:bold;font-size:14px;text-align:center;background-image:url(\'pictures/Dep_txt.bmp\');background-repeat:repeat-x;">
Ajouter Produits
</td>
<td width="7" align="right">
<img src="pictures/Dep_a_txt2.bmp" width="7" height="34" border="0" />
</td>
</table>
</div>
</td>
</tr>
<tr>
<td>
<table width="515" border="0" cellpadding="0" cellspacing="0" bgcolor="#BBBBBB" align="center">
<form method="post" action="" enctype="multipart/form-data">
<tr>
<td width="500" align="center" colspan="2">Titres :</td>
</tr>
<tr>
<td width="150" align="right">Titre fr : </td><td width="350" align="left"><input type="text" name="Titre_fr" size="40"/></td>
</tr>
<tr>
<td width="150" align="right">Titre Ang : </td><td width="350" align="left"><input type="text" name="Titre_en" size="40"/></td>
</tr>
<tr>
<td width="500" align="center" colspan="2">Catégorie :</td>
</tr>
<tr>
<td width="150" align="right">Choix : </td>
<td width="350" align="left">
<select Name="Categorie">
<option value=""></option>
<option value="pcs">Ordinateurs complets</option>
<option value="portables">Portables</option>
<option value="promos">Promotions</option>
<option value="pieces">Pièces ordinateur</option>
</select>
</td>
</tr>
<tr>
<td width="150" align="right">Fichier description fr : </td><td width="350" align="left"><input type="text" name="Desc_fr" size="40"/></td>
</tr>
<tr>
<td width="150" align="right">Fichier description en : </td><td width="350" align="left"><input type="text" name="Desc_en" size="40"/></td>
</tr>
<tr>
<td width="500" align="center" colspan="2">Images : (jpg format 4:3)</td>
</tr>
<tr>
<td width="150" align="right">Fichier Grande Image : </td><td width="350" align="left"><input type="file" name="ImgG"/></td>
</tr>
<tr>
<td width="150" align="right">Fichier Petite Image1 : </td><td width="350" align="left"><input type="file" name="ImgP1"/></td>
</tr>
<tr>
<td width="150" align="right">Fichier Petite Image2 : </td><td width="350" align="left"><input type="file" name="ImgP2"/></td>
</tr>
<tr>
<td width="150" align="right">Fichier Petite Image3 : </td><td width="350" align="left"><input type="file" name="ImgP3"/></td>
</tr>
<tr>
<td width="500" align="center" colspan="2">Prix :</td>
</tr>
<tr>
<td width="150" align="right">Prix du produit : </td><td width="350" align="left"><input type="text" name="Prix" size="10"/> €</td>
</tr>
<tr>
<td colspan="2" width="500"><table width="100%"><tr><td align="right"><input class="input_btn" type="reset" value="Effacer"> <input class="input_btn" name="envoyer" type="submit" value="Ajouter"></td></tr></table></td>
</tr>
</form>
</table>
</td>
</tr>
<tr>
<td>
<div class="rech_client_bot">
<img src="pictures/Form_bot.bmp" Width="515" Height="9"/>
</div>
</td>
</tr>
</table>
</div>
</div>
';
}
?>
Et voici celle ou mes produites devrais s'afficher avec les images (qui elles ne s'affichent pas )<?php
include("tools/db_con.inc.php");
$sql = "SELECT * FROM `tb_products` WHERE Categorie='pcs'" ;
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$result=mysql_query($sql,$db);
echo'
<div class="BodyProd">
<br/>
<div STYLE="width:300px;background:#ff0;font-size:18px;font-weight:bold;margin-left:20%;margin-right:20%;text-align:center;">
PC\'s complets avec options
</div>
<br/><br/>
';
While($row=mysql_fetch_array($result))
{
echo'
<div STYLE="border:1px solid #bbb;width:670px;padding:5px;">
<table cellspacing="0" cellpadding="0" border="0" width="660">
<tr>
<td colspan="5" align="center"><div STYLE="font-size:14px;color:#00f;font-weight:bold;">'.$row['Titre_fr'].' <font color="#acacac" size="10px">[id:'.$row['ID_Products'].']</font></div></td>
</tr>
<tr>
<td colspan="3">
<a href="#" class="info2">
<img src="Products/'.$row['ID_Products'].'/'.$row['ImgG'].'" width="160" height="120" border="0"/>
<span>
<div STYLE="border:3px solid #bbbbff;width:400px;height:300px;">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<img src="Products/'.$row['ID_Products'].'/'.$row['ImgG'].'" width="400" height="300" border="0"/>
</td>
</tr>
</table>
</div>
</span>
</a>
</td>
<td colspan="2" width="500">
<div STYLE="width:500px;padding-left:5px;padding-right:5px;font-size:14px;">';
echo $row['Description_fr'];
echo'</div></td>
</tr>
<tr>
<td colspan="5"></td>
</tr>
<tr>
<td width="53" align="center">
<a href="#" class="info2">
<img src="Products/'.$row['ID_Products'].'/'.$row['ImgP1'].'" width="50" height="30" border="0"/>
<span>
<div STYLE="border:3px solid #bbbbff;width:400px;height:300px;">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<img src="Products/'.$row['ID_Products'].'/'.$row['ImgP1'].'" width="400" height="300" border="0"/>
</td>
</tr>
</table>
</div>
</span>
</a>
</td>
<td width="53" align="center">
<a href="#" class="info2">
<img src="Products/'.$row['ID_Products'].'/'.$row['ImgP2'].'" width="50" height="30" border="0"/>
<span>
<div STYLE="border:3px solid #bbbbff;width:400px;height:300px;">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<img src="Products/'.$row['ID_Products'].'/'.$row['ImgP2'].'" width="400" height="300" border="0"/>
</td>
</tr>
</table>
</div>
</span>
</a>
</td>
<td width="53" align="center">
<a href="#" class="info2">
<img src="Products/'.$row['ID_Products'].'/'.$row['ImgP3'].'" width="50" height="30" border="0"/>
<span>
<div STYLE="border:3px solid #bbbbff;width:400px;height:300px;">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<img src="Products/'.$row['ID_Products'].'/'.$row['ImgP3'].'" width="400" height="300" border="0"/>
</td>
</tr>
</table>
</div>
</span>
</a>
</td>
<td width="400">
</td>
<td align="right" width="100" STYLE="background:#ff0;">
Prix : <b>'.$row['Prix'].' €</b>
</td>
</tr>
</table>
</div>
<br>
';
}
echo'
</div>
';
?>
Je vous remercie d'avance pour vos conseils