Page 1 sur 2

upload image !

Posté : 02 nov. 2005, 23:29
par StarT
Salut tout le monde, je viens de créer un formulaire qui contient beaucoup d'informations
la 1ère partie du formulaire a été attribuée aux details annonces (type annonce, ville, pays, rubrique ...)
la 2ième partie est consacrée pour uploader une image si on veut illustrer l'annonce (ce champ est facultatif)
et la 3ième partie aux coordonées client qui a passé l'annonce (nom, prénom, ville, adresse, ...)
et puis un bouton Valider !

cette form a pour action la page PassAnn.php, j'ai consulté le tutorial "Upload" et ça ne marche très bien que si j'ajoute une form que pour le bouton "Upload" et "Parcourir" sinon ça ne marche pas !
Pouvez vous m'aider ?!

voilà mon fichier passAnn.php
<?
include("gestion/config.php");
include ("fonctions.php");
?>
<?php if(isset($_FILES['photo'])){  
// params  unset($erreur);  
$extensions_ok = array('png', 'gif', 'jpg', 'jpeg');  
$taille_max = 100000;  
//$dest_dossier = '/home/damien/photos/';  
// utilisez également des slashes sous windows : 
$dest_dossier  = 'c:/images/';  
// vérifications  
if( !in_array( substr(strrchr($_FILES['photo']['name'], '.'), 1), $extensions_ok ) )  
{    
$erreur = 'Veuillez sélectionner un fichier de type png, gif ou jpg !';    
}  
elseif
(
 file_exists($_FILES['photo']['tmp_name'])           
 and filesize($_FILES['photo']['tmp_name']) > $taille_max)  
 {    
 $erreur = 'Votre fichier doit faire moins de 500Ko !';  
 }  
 // copie du fichier  
 if(!isset($erreur))  {    $dest_fichier = basename($_FILES['photo']['name']);    
 // formatage nom fichier    
 // enlever les accents    
 $dest_fichier = strtr($dest_fichier,     'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ',     'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');    
 // remplacer les caracteres autres que lettres, chiffres et point par _    
 $dest_fichier = preg_replace('/([^.a-z0-9]+)/i', '_', $dest_fichier);    
 // copie du fichier   
  move_uploaded_file($_FILES['photo']['tmp_name'], $dest_dossier . $dest_fichier);  
  }} 
  ?>
  
  <!-- Erreur ? -->
  <?php if(isset($erreur)){  echo '<p>', $erreur ,'</p>';}?>
<?

 $typeAnnonce    = isset($_POST['typeAnnonce'])    ? $_POST['typeAnnonce']    : (isset($_GET['typeAnnonce'])    ? $_GET['typeAnnonce'] : ""); 

 $rubrique    = isset($_POST['rubrique'])    ? $_POST['rubrique']    : (isset($_GET['rubrique'])    ? $_GET['rubrique'] : ""); 

 $pays_combo   = isset($_POST['pays_combo'])    ? $_POST['pays_combo']    : (isset($_GET['pays_combo'])    ? $_GET['pays_combo'] : ""); 

 $txtvill    = isset($_POST['txtvill'])    ? $_POST['txtvill']    : (isset($_GET['txtvill'])    ? $_GET['txtvill'] : ""); 

 $parution    = isset($_POST['parution'])    ? $_POST['parution']    : (isset($_GET['parution'])    ? $_GET['parution'] : ""); 

 $sub_type_achat    = isset($_POST['sub_type_achat'])    ? $_POST['sub_type_achat']    : (isset($_GET['sub_type_achat'])    ? $_GET['sub_type_achat'] : ""); 

 $sub_type_logement   = isset($_POST['sub_type_logement'])    ? $_POST['sub_type_logement']    : (isset($_GET['sub_type_logement'])    ? $_GET['sub_type_logement'] : ""); 

$photo  = isset($_POST['photo '])    ? $_POST['photo ']    : (isset($_GET['photo'])    ? $_GET['photo'] : ""); 

 $description    = isset($_POST['description'])    ? $_POST['description']    : (isset($_GET['description'])    ? $_GET['description'] : ""); 

 $telEmail   = isset($_POST['telEmail'])    ? $_POST['telEmail']    : (isset($_GET['telEmail'])    ? $_GET['telEmail'] : ""); 
  
 $Nom   = isset($_POST['Nom'])    ? $_POST['Nom']    : (isset($_GET['Nom'])    ? $_GET['Nom'] : ""); 
 
 $Prenom   = isset($_POST['Prenom'])    ? $_POST['Prenom']    : (isset($_GET['Prenom'])    ? $_GET['Prenom'] : ""); 
 
 $Adresse   = isset($_POST['Adresse'])    ? $_POST['Adresse']    : (isset($_GET['Adresse'])    ? $_GET['Adresse'] : ""); 

 $Ville    = isset($_POST['Ville'])    ? $_POST['Ville']    : (isset($_GET['Ville'])    ? $_GET['Ville'] : ""); 

 $TelBureau    = isset($_POST['TelBureau'])    ? $_POST['TelBureau']    : (isset($_GET['TelBureau'])    ? $_GET['TelBureau'] : ""); 
 
 $TelDomicile    = isset($_POST['TelDomicile'])    ? $_POST['TelDomicile']    : (isset($_GET['TelDomicile'])    ? $_GET['TelDomicile'] : ""); 

 $email    = isset($_POST['email'])    ? $_POST['email']    : (isset($_GET['email'])    ? $_GET['email'] : ""); 
 
 $Identif   = isset($_POST['Identif'])    ? $_POST['Identif']    : (isset($_GET['Identif'])    ? $_GET['Identif'] : ""); 
$cadre    = isset($_POST['cadre'])    ? $_POST['cadre']    : (isset($_GET['cadre'])    ? $_GET['cadre'] : "No"); 
$images="";


 $sql = "insert into achat (id_achat,pays,ville,location,offre,parution,type_achat,type_logement,description,photo,cadre,telemail) values ('','$pays_combo','$Ville','$rubrique','$typeAnnonce','$parution','$sub_type_achat','$sub_type_logement','$description','$photo','$cadre','$telEmail')";

$test= mysql_query($sql) or die(mysql_error());


//echo '.<p>'.$sql.'</p>';

 $sql1 = "insert into client (id_client,nom,prenom,ident,adresse,telbureau,teldomicile,email,ville) values ('','$Nom','$Prenom','$Identif','$Adresse','$TelBureau','$TelDomicile','$email','$txtvill')";
 $test1=mysql_query($sql1) or die(mysql_error());
// echo '.<p>'.$sql1.'</p>';
if($test and $test1) {
echo("<script type=\"text/javascript\">alert('Votre annonce a été ajoutée avec succès !');</script>"); }
else
{ echo("<script type=\"text/javascript\">alert('Ajout non effectué !');</script>"); 

}
 

//$address="passannonce.php";
//echo"<META HTTP-EQUIV='Refresh' CONTENT='0;URL=$address'>";
 ?>

Posté : 03 nov. 2005, 00:29
par Truc
je ne comprend pas trop ... mais tu veut dire que tu dois mettre 2 boutons submit un pour les champs texte et l'autre pour l'image a uploader ?

et
et ça ne marche très bien que si
c'est a dire un message d'erreur ou l'upload ne se fait pas ?

Posté : 03 nov. 2005, 00:50
par StarT
Salut Truc, non je ne veux pas mettre deux boutons, je veux que mon formulaire posséde qu'un bouton valider et que le traitement de l'Upload s'effectue au niveau de la page que j'ai mis au dessus PassAnn.php avec l'insertion des données dans la BDD

Posté : 03 nov. 2005, 02:16
par Truc
Hmm oui alors deja Bonsoir (que je suis mal poli moi :oops: )

Mais en gros je voi toujours pas le probleme si tu as repris de code de la fac il ne devrai pas y avoir de problemes.

C'est normal de mettre un formulaire pour le champ de type "fichier" et le bouton valider, c'est un champ comme tous les autres tu peut donc l'inclure dans le reste du fomulaire avec les noms, prenoms, etc... et récupérer dans ce fichier que tu nous montres.

L'upload se fait fait ?

La récupération des variables est ok ? (mais je me demande pourquoi tu les passe en POST et en GET :-k )

Les requetes sont bonnes aussi ?

Pas de message d'erreur ? :-k

Posté : 03 nov. 2005, 03:48
par StarT
oui tout est bon, mes données sont très bien enregistrées dans ma BDD sauf l'image d'upload ! c'est ça que je ne comprends pas :roll:

Posté : 03 nov. 2005, 20:10
par Truc
Alors tu as cette ligne
$photo  = isset($_POST['photo '])    ? $_POST['photo ']    :
tu essai donc de récupèrer le contenu du champ file nomé "photo" or ici tu as "photo " avec un espace a la fin, donc cet index n'eiste pas et le test va toujours renvoyer $photo="";

c'est donc ceci qui va etre inséré dans la BD !

Mais meme si tu réctifie tu ne va pas récupèrer ce que tu veut ! en effet un echo $_POST['photo ']; va afficher => "array" puisque c'est un tableau multidirectionel exemple $_POST['photo ']['name'] !

Tu dois donc inserer le nom qu'aura l'image sur le ftp ici $dest_fichier

Tu peut aussi ajouter un test pour savoir si l'upload s'est bien éffectué:
if(move_uploaded_file($_FILES['photo']['tmp_name'], $dest_dossier . $dest_fichier))
{
   //l'upload est ok
   $fichier_bd=$dest_fichier;
}
else
{
   // probleme d'upload
   $fichier_bd="valeur par défaut";
}

avec ce code tu insere donc la variable $fichier_bd dans la base de données.

Posté : 05 nov. 2005, 01:18
par StarT
Merci Truc, ça marche très bien mais saus cette partie de code qui est destinée à faire réduire le nombre maximal de caractères qui est fixé à 150 caractères permis dans la zone de texte TextArea "description" qui contient le texte de l'annonce alors que moi je veux que ça marchera avec le upload + le traitement de caractères limités

voila la partie conscrée au traitement de caractères limités :
************ la fonction du traitement ! ***************
function controle()
{
max=150;
a=document.form1.description.value.length;
b=(max-a);

if (a <= max)document.getElementById("nbre").innerHTML="Il ne vous reste plus que "+b+" caractères";

else
{
document.getElementById("nbre").innerHTML="Vous ne pouvez plus entrer de caractères";
document.getElementById("log").setAttribute("readonly","");
}
}
</script>

************ la forme du traitement ! ***************

<table width="100%" border="0">
<form>
<tr>
<td width="46%" align="center" valign="top"><br> <span class="txt11">
<div align="center">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="txt11">Texte de votre annonce</td>
</tr>
<tr>
<td><span id="nbre" class="txt10"></span></td>
</tr>

</table>
</div>
</span><br> </td>
<td width="54%"><span class="txt11">

<textarea name="description" cols="40" rows="4" class="txt1" id="description" onKeyPress="controle()"></textarea>
</span></td>
</tr>
</form>
</table>
voilà le code en entier :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<link href="../tester/style.css" rel="stylesheet" type="text/css">
<title>:: Test </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--Fireworks 8 Dreamweaver 8 target.  Created Mon Oct 31 13:28:32 GMT+0000 (Greenwich) 2005-->
<style type="text/css">
<!--
body {
	background-color: #F49902;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style2 {FONT-FAMILY:Tahoma; COLOR: #ECC600; font-size: 11px;}
.style1 {color: #FFFFFF}
.style3 {	FONT-FAMILY: Tahoma;
	COLOR: #ECC600;
	font-size: 12px;
	font-weight: bold;
}
.style5 {FONT-FAMILY: Tahoma; COLOR: #BC1B2B; font-size: 12px; font-weight: bold; }
-->
</style>
<script language="JavaScript"> 
function controle() 
{ 
    max=150; 
    a=document.form1.description.value.length; 
    b=(max-a); 
     
    if (a <= max)document.getElementById("nbre").innerHTML="Il ne vous reste plus que "+b+" caractères"; 
         
    else 
        { 
            document.getElementById("nbre").innerHTML="Vous ne pouvez plus entrer de caractères"; 
            document.getElementById("log").setAttribute("readonly",""); 
        } 
} 
</script> 
</head>
<body>
<table width="785" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="charte1.png" fwbase="index.jpg" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
  <tr>
   <td><img src="../tester/images/spacer.gif" width="12" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="12" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="14" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="118" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="16" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="49" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="50" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="61" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="407" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="28" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="17" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="1" border="0" alt=""></td>
  </tr>

  <tr>
   <td colspan="12"><img name="index_r1_c1" src="../tester/images/index_r1_c1.jpg" width="785" height="4" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="4" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="4" colspan="3"><img name="index_r2_c1" src="../tester/images/index_r2_c1.jpg" width="38" height="71" border="0" alt=""></td>
   <td rowspan="3" colspan="4"><img name="index_r2_c4" src="../tester/images/index_r2_c4.jpg" width="184" height="68" border="0" alt=""></td>
   <td colspan="5"><img name="index_r2_c8" src="../tester/images/index_r2_c8.jpg" width="563" height="5" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="5" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="3"><img name="index_r3_c8" src="../tester/images/index_r3_c8.jpg" width="50" height="66" border="0" alt=""></td>
   <td colspan="2"><img name="index_r3_c9" src="../tester/images/index_r3_c9.jpg" width="468" height="60" border="0" alt=""></td>
   <td rowspan="3" colspan="2"><img name="index_r3_c11" src="../tester/images/index_r3_c11.jpg" width="45" height="66" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="60" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="2" colspan="2"><img name="index_r4_c9" src="../tester/images/index_r4_c9.jpg" width="468" height="6" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="3" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="4"><img name="index_r5_c4" src="../tester/images/index_r5_c4.jpg" width="184" height="3" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="3" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="12" background="../tester/images/index_r6_c1.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr>
       <td width="39%">&nbsp;</td>
       <td width="57%" class="txt11"><div align="center">Home   |  Qui sommes-nous     |   Contact   |   Publicit&eacute;   |   S'abonner  |   Favoris</div></td>
       <td width="4%">&nbsp;</td>
     </tr>
   </table></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="36" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="12"><img name="index_r7_c1" src="../tester/images/index_r7_c1.jpg" width="785" height="9" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="9" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="5"><img name="index_r8_c1" src="../tester/images/index_r8_c1.jpg" width="172" height="10" border="0" alt=""></td>
   <td colspan="6" rowspan="15" bgcolor="#BC1B2B">
  <fieldset>
<table width="100%" height="100%" border="0">
<form name="form1" method="post" action="t2.php" enctype="multipart/form-data">
  <tr> 
          <td height="15" colspan="5" bgcolor="#ECC600" class="style5"><div align="left">D&eacute;tails 
            de votre Annonces : </div></td>
        </tr>
  <tr>
    <td width="20%" class="txt11"><div align="left">Type annonce</div></td>
    <td width="28%" class="txt11">
      
          <div align="left">
            <select name="typeAnnonce" class="txt1">
              <option value="">S&eacute;lectionnez</option>
              <option value="1">Demande</option>
              <option value="0">Offre</option>
            </select>
            </div></td>
    <td width="27%"><div align="left"><span class="txt11">Indiquez votre parution</span></div></td>
    <td width="25%"><div align="left"><span class="txt11">
      <select name="parution" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? 
						include("gestion/config.php");
						$select=mysql_query("SELECT porution FROM parution order by id_porution"); 
					 
								while ($row = mysql_fetch_array($select))
								{
									$porution= $row["porution"];
									echo"<option value=\"$porution\">";
										echo"$porution";
									echo"</option>";
								} ?>
      </select>
    </span></div></td>
  </tr>
  <tr>
    <td class="txt11"><div align="left">Rubrique</div></td>
    <td class="txt11">
      
          <div align="left">
            <select name="rubrique" class="txt1">
              <option value="">S&eacute;lectionnez</option>
              <option value="0">Vente</option>
              <option value="1">Location</option>
            </select>
            </div></td>
    <td><div align="left"></div></td>
    <td><div align="left"></div></td>
  </tr>
  <tr>
    <td><div align="left"><span class="txt11">Type du bien </span></div></td>
    <td><div align="left"><span class="txt11">
      <select name="sub_type_achat" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? 
					 $select = mysql_query("select * from typeachat");
								while ($row = mysql_fetch_array($select))
								{
									$type_achat = $row["type_achat"];
									echo"<option value=\"$type_achat\">";
										echo"$type_achat";
									echo"</option>";
								
								}
							
						
							?>
      </select>
    </span></div></td>
    <td><div align="left"><span class="txt11">Pays du bien </span></div></td>
    <td><div align="left"><span class="txt11">
      <select name="pays_combo" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? 
						include("gestion/config.php");
						$select=mysql_query("SELECT DISTINCT pays, id_pays FROM pays order by id_pays"); 
					 
								while ($row = mysql_fetch_array($select))
								{
									$pays= $row["pays"];
									echo"<option value=\"$pays\">";
										echo"$pays";
									echo"</option>";
								} ?>
      </select>
    </span></div></td>
    </tr>
  <tr>
    <td><div align="left"><span class="txt11">ville du bien </span></div></td>
    <td><div align="left"><span class="txt11">
      <select name="Ville" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? $select=mysql_query("SELECT DISTINCT ville, id_ville FROM villes order by ville"); 
					 
								while ($row = mysql_fetch_array($select))
								{
									$ville = $row["ville"];
									echo"<option value=\"$ville\">";
										echo"$ville";
									echo"</option>";
								} ?>
      </select>
    </span></div></td>
    <td><div align="left"><span class="txt11">NB Pi&egrave;ces </span></div></td>
    <td><div align="left"><span class="txt11">
      <select name="sub_type_logement" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? 
								$select2 = mysql_query("select * from logement");
								while ($row = mysql_fetch_array($select2))
								{
									$sub_type_logement = $row["type_logement"];
									echo"<option value=\"$sub_type_logement\">";
										echo"$sub_type_logement";
									echo"</option>";
								
								}
							

							?>
      </select>
    </span></div></td>
    </tr>
  <tr>
    <td colspan="4" class="txt11"><div align="left">
      <table width="100%" border="0">
              <form>
                      <tr> 
                        <td width="46%" align="center" valign="top"><br> <span class="txt11"> 
                          <div align="center"> 
                            <table width="100%" border="0" align="center"  cellpadding="0" cellspacing="0">
                              <tr> 
                                <td class="txt11">Texte de votre annonce</td>
                              </tr>
                              <tr> 
                                <td><span  id="nbre"  class="txt10"></span></td>
                              </tr>
							  
                            </table>
                          </div>
                          </span><br> </td>
                        <td width="54%"><span class="txt11"> 
                          
              <textarea name="description" cols="40" rows="4"  class="txt1" id="description" onKeyPress="controle()"></textarea>
                          </span></td>
                      </tr>
                    </form>
      </table>
    </div></td>
    </tr>
  <tr>
    <td colspan="2" class="txt11"><div align="left"><span class="txt11">T&eacute;l&eacute;phonne/ E-mail 
      &agrave; faire figurer dans l'annonce </span></div></td>
    <td colspan="2">
      
          <div align="left">
            <input name="telEmail" type="text" class="txt1">
            </div></td>
    </tr>
  <tr>
    <td colspan="2" class="txt11"><div align="left"><span class="txt11">La photo &agrave; inserer dans 
      l'annonce (+30 DH) </span></div></td>
    <td colspan="2">
      
          <div align="left">
            <input type="file" name="photo" class="txt1"/>      
            </div></td>
    </tr>
   <tr> 
          <td height="15" colspan="4" bgcolor="#ECC600"><div align="left"><span class="style5">Vos 
            Coordonn&eacute;es : </span><span class="txt1"> ces renseignements 
            sont confidentiels au journal. </span></div></td>
        </tr>
  <tr>
    <td class="txt11"><div align="left">Nom et Pr&eacute;nom </div></td>
    <td class="txt11">
      
          <div align="left">
            <select name="Identif" class="txt1">
              <option value="Mme">Mme</option>
              <option value="Mme">Mlle</option>
              <option value="Mr">Mr</option>
            </select>
            </div></td>
    <td class="txt11">
      
          <div align="left">
            <input name="Nom" type="text" class="txt1">
            </div></td>
    <td class="txt11">
      
              <div align="left">
                <input name="Prenom" type="text" class="txt1">
              </div></td>
  </tr>
  <tr>
    <td><div align="left"><span class="txt11">Adresse</span></div></td>
    <td><div align="left"><span class="txt11">
      <input name="Adresse" type="text" class="txt1">
    </span></div></td>
    <td align="left"><div align="left"><span class="txt11">ville</span></div></td>
    <td><div align="left"><span class="txt11">
      <select name="txtvill" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? $select=mysql_query("SELECT DISTINCT ville, id_ville FROM villes order by ville"); 
					 
								while ($row = mysql_fetch_array($select))
								{
									$ville = $row["ville"];
									echo"<option value=\"$ville\">";
										echo"$ville";
									echo"</option>";
								} ?>
      </select>
    </span></div></td>
  </tr>
  <tr>
    <td><div align="left"><span class="txt11"> T&eacute;l. Bureau </span></div></td>
    <td><div align="left"><span class="txt11">
      <input name="TelBureau" type="text" class="txt1">
    </span></div></td>
    <td><div align="left"><span class="txt11">T&eacute;l. Dom </span></div></td>
    <td><div align="left"><span class="txt11">
      <input name="TelDomicile" type="text" class="txt1">
    </span></div></td>
  </tr>
  <tr>
    <td><div align="left"><span class="txt11">
      </span><span class="txt11"></span><span class="txt11">
      </span><span class="txt11"></span></div>
      <span class="txt11"><label></label>
      </span>
      </td>
    <td><div align="left"></div></td>
    <td><div align="left"></div></td>
  </tr>
  <tr> 
          <td height="15" colspan="4" bgcolor="#ECC600"><div align="left"><span class="style5">Mode 
            de paiement : </span></div></td>
        </tr>
  <tr>
    <td colspan="3"class="txt11">Envoyer votre ch&egrave;que libell&eacute; 
                  &agrave; l'ordre de : EDC , 357 Boulevard Mohamed V - Casablanca 
                  - Maroc T&eacute;l. +212 (0)22 40 78 16 - Fax : (0)22 40 78 
                  14 </td>
    <td><div align="right"><img src="img-/valid.jpg" width="82" height="20" onClick="form1.submit()"></div></td>
  </tr>
  </form>
</table>
<!-- champs d'envoi de fichier, de type file -->
</legend>
  </fieldset>
   </td>
   <td rowspan="16"><img name="index_r8_c12" src="../tester/images/index_r8_c12.jpg" width="17" height="404" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="10" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="15"><img name="index_r9_c1" src="../tester/images/index_r9_c1.jpg" width="12" height="394" border="0" alt=""></td>
   <td rowspan="2" colspan="3"><img name="index_r9_c2" src="../tester/images/index_r9_c2.jpg" width="144" height="24" border="0" alt=""></td>
   <td rowspan="15"><img name="index_r9_c5" src="../tester/images/index_r9_c5.jpg" width="16" height="394" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="20" border="0" alt=""></td>
  </tr>
  <tr>
   <td><img src="../tester/images/spacer.gif" width="1" height="4" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r11_c2" src="../tester/images/index_r11_c2.jpg" width="144" height="4" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="4" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r12_c2" src="../tester/images/index_r12_c2.jpg" width="144" height="16" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="16" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r13_c2" src="../tester/images/index_r13_c2.jpg" width="144" height="4" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="4" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r14_c2" src="../tester/images/index_r14_c2.jpg" width="144" height="17" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="17" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r15_c2" src="../tester/images/index_r15_c2.jpg" width="144" height="5" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="5" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r16_c2" src="../tester/images/index_r16_c2.jpg" width="144" height="22" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="22" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="2" colspan="3"><img name="index_r17_c2" src="../tester/images/index_r17_c2.jpg" width="144" height="41" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="33" border="0" alt=""></td>
  </tr>
  <tr>
   <td><img src="../tester/images/spacer.gif" width="1" height="8" border="0" alt=""></td>
  </tr>
  <tr>
   <td><img name="index_r19_c2" src="../tester/images/index_r19_c2.jpg" width="12" height="70" border="0" alt=""></td>
   <td colspan="2" bgcolor="#BC1B2B"><a href="#" class="style2">Architectes</a><br>
     <a href="#" class="style2">Promoteurs</a><br>
     <a href="#" class="style2">Bureaux d'&eacute;tudes</a><br>
     <a href="#" class="style2">G&eacute;om&egrave;tres/Topographes</a><br>
     <a href="#" class="style2"> Notaires</a></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="70" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r20_c2" src="../tester/images/index_r20_c2.jpg" width="144" height="69" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="69" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r21_c2" src="../tester/images/index_r21_c2.jpg" width="144" height="96" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="96" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="2" colspan="3"><img name="index_r22_c2" src="../tester/images/index_r22_c2.jpg" width="144" height="26" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="16" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="6"><img name="index_r23_c6" src="../tester/images/index_r23_c6.jpg" width="596" height="10" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="10" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="12"><img name="index_r24_c1" src="../tester/images/index_r24_c1.jpg" width="785" height="20" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="20" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="12"><img name="index_r25_c1" src="../tester/images/index_r25_c1.jpg" width="785" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="1" border="0" alt=""></td>
  </tr>
</table>
</body>
</html>

Posté : 05 nov. 2005, 03:10
par Truc
certainement a cause du "readonly" que tu ajoute dans le javascript:
 document.getElementById("log").setAttribute("readonly","");
enleve cette ligne et fait un test.

Les champs qui sont rendu "indisponible" (pas modifiable) ne sont pas envoyé et donc ne peuvent etre récupèré par POST.

Tu as 2 solutions:
soit mettre un cahmp caché qui contiendra le texte, a faire en javascript pour affecter le texte d'un champ a un autre champ.

soit de ne pas bloquer l'utilisation du champ de texte, si la personne se rend compte qu'elle a fait une erreur de frappe alors qu'elle a dépasée les 150 caratères il n'y aura plus moyen de modifier le texte. ajoute ces 2 ligne pour bloquer l'ajout de caratères sans pour autant bloquer le champ:
var texte = document.getElementById("description").value;
document.getElementById("description").value= texte.substring(0,150);
a la place de la ligne donné audessus avec le "readonly".

Posté : 05 nov. 2005, 03:19
par StarT
J'ai toujours le même problème Truc :?

Posté : 05 nov. 2005, 03:22
par Truc
C'est quoi exactement le probleme ?

Le contenu du champ texte (textarea) n'est pas entrée dans la BD ?
si c'est le cas affiche avec $_POST['description'].

Sinon le blocage des caratères fonctionne ?

Posté : 05 nov. 2005, 03:22
par StarT
Non c'est pas ça C l'image qui ne se telecharge pas si j'ajoute le textArea avec traitement de compte de caractères !

Posté : 05 nov. 2005, 03:27
par Truc
Euh oui effectivement rien a voir :lol:

peut etre un conflit de javascript, limite le code juste a ceci:
function controle()
{
var texte = document.getElementById("description").value;
document.getElementById("description").value= texte.substring(0,150);
}
et verifi si dasn ce cas tu récupère le contenu du cahmp texte et l'upload

Posté : 05 nov. 2005, 03:31
par StarT
je reccupere toujours que le texte saisi dans le textarea !

Posté : 05 nov. 2005, 03:43
par Truc
Je vois vraiment pas d'ou peut provenir l'erreur, je ferai des tests demain (enfin tout a l'heure :wink: ) et si je trouve quelque chose je reviendrai :wink:

Posté : 05 nov. 2005, 03:45
par StarT
Merci beaucoup pour ton aide Truc ! Bonne soirée :wink: