le fichier xml est du style :
<item><numero> 0606060606 </numero> <nom> Machin </nom> <prenom> JP </prenom> </item>
Avec d'autres info comme l'adresse etc et chaque item correspond à un contact.
Mon code html/php c'est :
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
| <section class="accueil">
<?php
$fichier = '../document/contact.xml';
$xml = simplexml_load_file($fichier);
foreach($xml as $contact){
$tableau= array(
"numero" => $contact->numero,
"nom" =>$contact->nom,
"prenom"=>$contact->prenom,
);
}
function recherche(){
?>
<form method="post" action="contact.php">
<input type="text" name="recherche" />.
<input type="submit" value="Valider" />
</form>
<?php }
recherche();
?>
</section> |
Et du coup j'aimerai faire une recherche par critère, c'est à dire que si l'utilisateur recherche le contact grâce à son nom (par exemple) que toutes les informations de ce contact s'affichent.
Partager