Salut,
j'ai un csv formaté comme suit:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
"Intitulé1","Intitulé2","Intitulé3","Intitulé4",....,"Intituléx""Contenu_intitulé1","Contenu_intitulé2","Contenu_intitulé3","Contenu_intitulé4",......,"Contenu_intituléx"
Sachant que les contnu vide sont représenté par ,, par exemple:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
"Intitulé1","Intitulé2","Intitulé3","Intitulé4",....,"Intituléx""Contenu_intitulé1",,"Contenu_intitulé3",,......,"Contenu_intituléx"
j'ai donc créé ce script qui me permete de récupèrer la position des intitulé que j'ai defini en dure dans mon code php. Comment je pourrait faire pour récupérer le contenu associé aux intitulés inscrit en dure dans mon code php.
je sais que par exemple mon Intitulé2 qui à la position "2" donc est associé au contenu_Intitulé qui se trouve à la position (position Intituléx + position Intitulé2)

J'espere avoir était clair je code mon code php

Code : 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/* On ouvre le fichier à importer en lecture seulement */
 if (isset($_FILES['file'])){
 
	//intitulé champs csv
	$prenom = 'Prénom';
	$nom = 'Nom';
	$société  = 'Société ';
	$adresse = 'Rue (bureau)';
	$ville = 'Ville (bureau)';
	$telport = 'Tél. mobile';
	$telfixe = 'Téléphone société';
	$fax = 'Télécopie (autre)';
	$pays = 'Pays (bureau)';
	$mailperso = 'Adresse de messagerie 2';
	$mailpro = 'Adresse de messagerie';
	$statut = 'Suffixe';
 
 
 
	$file = $_FILES['file']['tmp_name']; 
	$handle = fopen($file,'r'); 
	$coumpteur = 0;
	$handle = fopen("$file", "r") or die("Cannot open $file");; 
	while (($data = fgetcsv($handle, 4096, ",")) !== FALSE) { 
 
		foreach ($data as $mots){
		//position champs intitulé csv
		$compteur++;
			if(	$mots == $prenom || 
				$mots == $prenom || 
				$mots == $nom || 
				$mots == $société || 
				$mots == $adresse ||
				$mots == $ville ||
				$mots == $telport ||
				$mots == $telfixe ||
				$mots == $fax ||
				$mots == $pays ||
				$mots == $mailperso ||
				$mots == $mailpro ||
				$mots == $statut){
				echo $mots." ".$compteur.'</br>';
 
			}
		}
	}
}?>