8722 sujets

Développement web côté serveur, CMS

Bonjour tous le monde.
Je vais faire un formulaire d'ajout d'une nouvelle affaire qui contient numéro et client etc
a cote du champs client je voudrais faire un bouton quand je clique sur cette bouton un table php mysql que j'ai déjà contient les informations de client nom,prénom,type,adresse..
va s'afficher et quand je clique sur un ligne de ce table le nom et prénom de se client seront
prisent et mettre dans mon champs client de formulaire ajouter affaire.
Merci pour votre aide.
Bonjour,

C'est très bien tout ça mais essaie d'abord d'avancer de ton côté avant de poster ici non ?

Commence d'abord par créer une page qui affiche tous tes clients, puis ajoute le bouton dont tu as besoin à chaque ligne. Ensuite, essaie de rédiger le script qui affichera les informations du client sélectionné au clic de ce bouton... Procède par étape.

Et si jamais tu bloques quelque-part, tu peux bien évidemment demander de l'aide ici Smiley smile

Hélas, personne ne te fournira le code tout fait, et puis on apprend rien quand on fait un simple copier/coller.

A bientôt,
Bonjour Loraga
J ai fait la page qui affiche tous les clients.
Voila mon code php


<?php  
$db = new PDO('mysql:host=localhost;dbname=gestion_affaire','root','');




$sql = "SELECT * FROM client";

$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);

$stmt = $db->query($sql);
$numRows = $db->query("SELECT COUNT(*) FROM client")->fetchColumn();



?>
<!DOCTYPE html>

<html>

<head>
	
  
  <title>Ajouter client</title>
  
</head>

<body >
	<h1>Ajouter un Confrere</h1>
	<h4>Cette page vous permet d ajouter un Client</h4>

	 
	<form name="form1" action="client.php" method="post" enctype="multipart/form-data" onSubmit="return verifier();"
     style="background-color:#ADD8E6;" >

   
	 
	 
    
  	
  	

      <fieldset class="class11">
            <legend>Information générales :</legend>
      
      <tr>
      <td>Nom</td> <td><input type="text" name="nom" / ></td> 
      </tr>
      <tr>
      <td>Type
      <select name="Id_type_client"> 
<?php	
	$sql = "SELECT Id_type_client,Type_client FROM type_client ORDER BY Id_type_client ASC;";
	$stmt = $db->prepare($sql);
	$stmt->execute();
	while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
?>
	<option value="<?php echo $row['Id_type_client']; ?>"><?php echo $row['Type_client']; ?></option>
<?php	} ?>
</select></td>
<tr>
      <td>
      Prenom</td> <td><input type="text" name="prenom" / ></td>
      </tr> <br>
      <tr>
        <td>
          Adresse :</td><td> <textarea   name="adresse">  </textarea>
             
        </td>
      </tr>
       <tr>
      <td>Tel</td> <td><input type="text" name="tel"/></td> 
      </tr>
       <br>
      <tr>
      <td>Ville</td> <td><input type="text" name="ville"/></td> 
      </tr>
      <tr>
        <td>

      
          Pays :</td><td><select  name="pays">
            <option ></option>
            <option  >Maroc</option> 
            <option  >Algérie</option> 
            <option  >France</option>
            <option  >Tunisie</option> 
            
             

          </select>
             
        </td>
      </tr><br>
      
      <tr>
        <td>
          Commentaires :</td><td> <textarea   name="commentaires" rows="8" cols="50" >  </textarea>
             
        </td>
      </tr>
        
      </fieldset>

  	
  	
  	<div >
  	  <button type="submit"  >Valider</button>
      <button type="reset"  >Annuler</button>
  	</div>
    
  	
  </form>

	<table border="1" width="100%" bgcolor="ffffcc"   >
		<tr><td>id</td><td>nom</td><td>type</td><td>prenom</td><td>adresse</td><td>ville</td><td>pays</td><td>tel</td>
<td>commentaires</td><td>supprimer</td></tr>
		<?php foreach ($rows as $row ) : ?>
			<tr>
				<td><?= $row['id_client']  ?></td>
				<td><?= $row['Nom_client']  ?></td>
				<td><?= $row['Type_client']  ?></td>
				<td><?= $row['Prenom_client']  ?></td>
				<td><?= $row['Adresse_client']  ?></td>
				<td><?= $row['Ville_client']  ?></td>
				<td><?= $row['Pays_client']  ?></td>
				<td><?= $row['Tel_client']  ?></td>
				<td><?= $row['commentaires_client']  ?></td>
				
				<td><a href="delclient.php?idd=<?= $row['id_client'] ?>"  onClick="Message()" > <img src ='drop.png'></a></td>
                <td><a href="updateclient.php?idd=<?= $row['id_client'] ?>" > <img src ='edit.png'></a></td>

                

			</tr>

		<?php endforeach; ?>
       
       <tr><td colspan=9> nombre total des client </td><td><?php echo $numRows; ?></td>
    <td><a href ='ajouterclient.php?'><img src ='imgajouter.png'></a></td>
	</tr>


	</table>

  
  
</body>
</html>


Merci
upload/1556277456-75319-exemple.png Bonjour tous le monde
je vais faire comme cette page quand je clique sur le bouton qui est a cote de champs
un table que j ai deja contient les client s affiche et quand je clique sur un ligne de table le nom et prenom seront prisent et les mettre dans ce champ.
Modifié par abdelo (26 Apr 2019 - 13:18)