Ola, et Ola Jordane45 si tu passe par là! :)
Bon alors je vais faire court: j'ai un formulaire qui récupère des infos, un ID, une chaîne de caractère "sauce", une chaîne de caractère "option", ensuite boisson (oui ou non) donc ça ok, et la qtée (ça ok). Bémol, le regex option chie! Une idée?
Code: commande_creator.php
if ( preg_match ( " #^[a-zA-Z ]{3,16}$# " , $sauce ) ){
echo "sauce ok blablabla";
} else {
header('Location: ../shop.php?var_shop=regex_sauce');
exit;
}
if ( preg_match ( " #^[a-zA-Z ]$# " , $option ) ){
echo "option ok blablabla";
} else {
header('Location: ../shop.php?var_shop=regex_option');
exit;
}
if ( preg_match ( " #^[a-z]{3}$# " , $boisson ) ){
echo "boisson ok blablabla";
} else {
header('Location: ../shop.php?var_shop=regex_boisson');
exit;
}
if ( preg_match ( " #^(^[0-9])$# " , $qty) ){
echo "qty ok blablabla";
} else {
header('Location: ../shop.php?var_shop=regex_qty');
exit;
}
edit
J'ai test de match plein de regex avec la phrase: "Pas d'option" par exemple. Aucune ne fonctionne.. hmm
Par contre avec celle la ça devrait fonctionner :
Et si tu as un "!" .. il faut aussi l'ajouter dans la regex
..etc...
A toi de voir ce dont tu as besoin.