Formulaire avec plusieurs enregistrement maj table

cheste71 Messages postés 3 Date d'inscription   Statut Membre Dernière intervention   -  
cheste71 Messages postés 3 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,
Tout d'abord, je débute.

J'essaie de créer un formulaire qui me permette de modifier le prix des produits par client.
Dans un premier temps, je sélectionne le client puis la liste de produit du client s'affiche dans le formulaire listeprod.
Jusque la pas de problème.

Le souci est que quand je clique sur le modifier, il ne se passe rien

code page formulaire :

	  <?php 
          include('./Connections/gestcostever.php');
      ?>

      <?php
      mysql_query("SET NAMES 'utf8'");
      ?>
<!-- Deb selection client --> 
		<div class="formulaire">     
		 <?php
        // table client
        mysql_select_db($database_gestcostever, $gestcostever);
        $query_rselectclt = "SELECT idclt, societe, note FROM client ORDER BY societe ASC";
        $rselectclt = mysql_query($query_rselectclt, $gestcostever) or die(mysql_error());
        $row_rselectclt = mysql_fetch_assoc($rselectclt);
        $totalRows_rselectclt = mysql_num_rows($rselectclt);
        ?>
        
        <?php
        if(isset($_POST['selectclt'])){
            //si la liste a été "postée" c ad choix fait
            $selectclt=$_POST['selectclt'];
        }else{
            $selectclt=-1;
        }
        ?>
               <?php
        if(isset($_POST['selectpdt'])){
            //si la liste a été "postée" c ad choix fait
            $selectpdt=$_POST['selectpdt'];
        }else{
            $selectpdt=-1;
        }
        ?>

       
        <form id="tabselclt"  action="" method="post">
          <table width="780px" align="left">
            <tr>
            <td width="200" align="left" valign="middle">Sélectionnez le client :</td>
              <td width="580" align="left" valign="middle">
                <select name="selectclt" id="selectclt" onchange="tabselclt.submit()">
                  <option value=-1>--Choisissez--</option>
                  <?php
        do{
                echo "<option value=\"".$row_rselectclt["idclt"]."\"";
        if($selectclt==$row_rselectclt['idclt']) { echo "selected"; }//ça c'est pour garder la selection lors du réaffichage 
        echo ">".$row_rselectclt["societe"]."</option>\n";
        }
                  
         while ($row_rselectclt = mysql_fetch_assoc($rselectclt));
          
        $row=mysql_num_rows($rselectclt);
        if ($row > 0) {
                mysql_data_seek($rselectclt, 0);
                  $row_rselectclt = mysql_fetch_assoc($rselectclt);
        }
        ?>
              </select></td>
            </tr>
        </table>
        </form>
        </div>
  <!-- Deb note client -->      
  		<div class="formulaire">     

          <?php 
        
                  if($selectclt != -1){ //si on a fait un choix
              ?>
        <form id="cltnote"  action="" method="post">
              <?php 
              $reqnote = mysql_query("SELECT note FROM client WHERE idclt='".$selectclt."'");
              
              $resnote=mysql_fetch_assoc($reqnote);
              ?>
          <table width="780px" align="left">
              <tr>
              <td align="left" valign="top" width="200">Informations : </td>
              <td width="580" align="left"><textarea name="note" cols="50" rows="5" ><?php echo $resnote['note']; ?></textarea></td>
              </tr>
              </table>
        </form>	
         </div>

<!-- Deb list produit -->
		<div class="formulaire">     
      <?php // selection des produits de la grille tarifaire.
        mysql_query("SET NAMES 'utf8'");
        mysql_select_db($database_gestcostever, $gestcostever);
        $query_rselectlistprod = "SELECT tc.idtarclt, tc.idclt, tc.idprod, tc.pvuht, p.idprod, p.nomprod FROM tarifclient tc, produit p WHERE tc.idclt = '".$_POST['selectclt']."' AND tc.idprod = p.idprod ORDER BY nomprod ASC";
        $rselectlistprod = mysql_query($query_rselectlistprod, $gestcostever) or die(mysql_error());
        $row_rselectlistprod = mysql_fetch_assoc($rselectlistprod);
        $totalRows_rselectlistprod = mysql_num_rows($rselectlistprod);
	  ?>
      
      <form id="listeprod" action="fonctions/f_modif_enr_tarifclient.php" method="post">
      
      <table width="780" aligh="left">
        <tr>
        	<td valign="middle" width="250">Produit</td>		
          	<td valign="middle">PUVHT</td>
        </tr>
         <?php do{
			echo "<input name=\"count[]\" type=\"hidden\" value=\"".$totalRows_rselectlistprod."\" /></td>\n"; 
  			echo "<input name=\"idtarclt[]\" type=\"hidden\" value=\"".$row_rselectlistprod['idtarclt']."\" /></td>\n";
  			echo "<tr><td valign=\"middle\" width=\"250\"><input name=\"nomprod[]\" size=\"50\" value=\"".$row_rselectlistprod['nomprod']."\" /></td>\n";
  			echo "<td valign=\"middle\" width=\"250\"><input name=\"pvuht[]\" size=\"50\" value=\"".$row_rselectlistprod['pvuht']."\" /></td></tr>\n";
  			}
			
   			while ($row_rselectlistprod = mysql_fetch_assoc($rselectlistprod));
  			$row=mysql_num_rows($rselectlistprod);
  			if ($row > 0) {
		  		mysql_data_seek($rselectlistprod, 0);
				$row_rselectlistprod = mysql_fetch_assoc($rselectlistprod);
  				}
				?>
      
        <tr>
        	<td width="200"></td>		
          	<td align="center" valign="middle">
          	  <input type="submit" name="button"  value="Modifier" />
   	        </td>
        </tr>
      </table>
      
  
      </form>
      </div>
          
          
          
          


          
                 <?php } //fermeture if si selclt !=-1 ?>
   
          
      <?php    
      //fermeture connexion à mysql
      mysql_close();
      
      ?>


Code de f_modif_enr_tarifclt
<?php include('../Connections/gestcostever.php');?>
<?php

$idtarclt = $_POST['idtarclt'];
$pvuht = $_POST['pvuht'];
mysql_query("SET NAMES 'utf8'");


mysql_query("SET NAMES 'utf8'");
$req=mysql_query("UPDATE tarifclient SET pvuht='$pvuht' WHERE idtarclt='$idtarclt'" )or die(mysql_error()); 

?>


Une petite idée du problème ?

Merci d'avance
A voir également:

1 réponse

cheste71 Messages postés 3 Date d'inscription   Statut Membre Dernière intervention  
 
En fait si je comprends bien, le formulaire "poste un tableau "
Si oui alors comment acceder a ce tableau ?
0