bonjour chers Tous,
je voudrais vous soumettre un soucis avec l'insertion de mes valeurs checkbox dans ma table...
J'ai con�u un formulaire avec des checkbox poss�dant des noms diff�rents comme ceci:
Code html : S�lectionner tout - Visualiser dans une fen�tre � part
<p><label>Domaine Fournitures:</label>  <input type="checkbox" name="domaine" value="Ordinateurs&PC" />Ordinateurs&PC <br><input type="checkbox" name="domaine1" value="Tablettes&Telephones" />Tablettes&Telephones <br /><input type="checkbox" name="domaine2" value="consommables Impression" />Consommables Impression <input type="checkbox" name="domaine3" value="Imprimantes laser&Jet encre" />Imprimantes laser&Jet encre <input type="checkbox" name="domaine4" value="Peripherique de Stockage" />Peripheriques de Stockage </p>
et mon code php pour l'insertion dans ma table:
Code php : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$nomentreprise = htmlentities($_POST['nomentreprise']);
		$contact = htmlentities($_POST['contact']);
		$email = htmlentities($_POST['email']);
		$ville = htmlentities($_POST['ville']);
		$login = htmlentities($_POST['login']);
		$password = htmlentities($_POST['password']);
		$domaine = htmlentities($_POST['domaine']);
		$domaine1 = htmlentities($_POST['domaine1']);
		$domaine2 = htmlentities($_POST['domaine2']);
		$domaine3 = htmlentities($_POST['domaine3']);
		$domaine4 = htmlentities($_POST['domaine4']);
		$legal = htmlentities($_POST['legal']);
		$local = htmlentities($_POST['local']);
		$livraison = htmlentities($_POST['livraison']);
		$date = htmlentities($_POST['date']);
 
		require('config.php');
 
		//$DB_base = mysqli_select_db( $link, "vision") or die("Selection de la base de données impossible");
		$sql = "INSERT INTO fournisseur(nomentreprise,contact,email,ville,login,password,domaine,domaine1,domaine2,domaine3,domaine4,legal,local,livraison,date) VALUES('" . $_POST['nomentreprise'] . "','" . $_POST['contact'] . "','" . $_POST['email'] . "','" . $_POST['ville'] . "','" . $_POST['login'] . "','".hash('sha256', $password)."','" . $_POST['domaine'] . "','" . $_POST['domaine1'] . "','" . $_POST['domaine2'] . "','" . $_POST['domaine3'] . "','" . $_POST['domaine4'] . "','" . $_POST['legal'] . "','" . $_POST['local'] . "','" . $_POST['livraison'] . "','" . $_POST['date'] . "')";
je rappelle que dans ma table, j'ai cr� differents noms pour mes champs checkbox afin de recueillir les valeurs!!!
le hic est qu'il recoit les informations effectivement dans ma table mais me donne un code d'erreur dans la validation du formulaire tel que:
Nom : erreur.png
Affichages : 304
Taille : 115,0 Ko
( ! ) Notice: Undefined index: domaine2 in C:\wamp\www\Site Magic Informatique\fichiers\fournisseur.php on line 14
j'aimerais savoir s'il ya une gestion particuliere pour les champs checkbox avec php et leur insertion? et dans mon exemple precis keskil faut faire?
Merci de m'aider!!!