ah oui mais ce que je t'ai proposé était un test d'affichage pour voir ce que contiennent ces variables donc à effectuer avant le "in_array()"
Les indices sont ok
if(eregi($motif,$_GET["nombre"]) && eregi($motif,$_GET["multi"]))
$_SESSION['tableau'][] = array("nombre"=>$_GET['nombre'],"multi"=>$_GET['multi'] );
j'ai pris sur le tuto http://jem-web.info/cv/tutos/tuto_panier.html la fonction:function verif_panier($ref_article)
{
/* On initialise la variable de retour */
$present = false;
/* On vérifie les numéros de références des articles et on compare avec l'article à vérifier */
if( count($_SESSION['tableau']['nombre']) > 0 && array_search($ref_article,$_SESSION['tableau']['nombre']) !== false)
{
$present = true;
}
return $present;
}
if(eregi($motif,$_GET["nombre"]) && eregi($motif,$_GET["multi"])) {
$_SESSION['tableau']["nombre"][] = $_GET['nombre'];
$_SESSION['tableau']["multi"][] = $_GET['multi'];
}
Ainsi $_SESSION['tableau']['nombre'] existera, et sera un tableau contenant tes nombres.function array_find($array,$search)
{
$present = false;
for ($i = 0; $i < count($array); $i++)
{
if( $array[$i]['nombre'] == $search ){$present = true; }
}
return $present;
}
if( ! in_array($_GET["nombre"], $_SESSION['tableau']["nombre"]))
// ajout if(!isset($_SESSION['tableau']))
{
$_SESSION['tableau'] = array();
}
if(isset($_GET['nombre']) && isset($_GET['multi]) )
{
// suite du script... test de l'existence des variables GET
if( ! in_array($_GET["nombre"], $_SESSION['tableau']["nombre"]))
{
$motif="^([0-9]+)$";
// vérification du format des variables GET et ajout à la session
if(eregi($motif,$_GET["nombre"]) && eregi($motif,$_GET["multi"]))
$_SESSION['tableau']["nombre"][] = $_GET['nombre'];
$_SESSION['tableau']["multi"][] = $_GET['multi'];
}
}
je dois faire une erreur car j'ai:if (in_array ($_GET["nombre"], $_SESSION['tableau']["nombre"])) {
print $_GET["nombre"];
}
ben la ça marche