Probleme PHP (if et else)
Résolu/Fermé
piloucyril
-
piloucyril -
piloucyril -
Bonjour,
après aboutissement de mon html , je prépare le php qui répond une fois que l'on ait cliqué sur le bouton valider , cependant mon PHP n'affiche rien du tout ( appart Détails : ) c'est rageant , help please je planche la dessus depuis ce matin !!! :(
après aboutissement de mon html , je prépare le php qui répond une fois que l'on ait cliqué sur le bouton valider , cependant mon PHP n'affiche rien du tout ( appart Détails : ) c'est rageant , help please je planche la dessus depuis ce matin !!! :(
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="fr">
<head>
<title>Configurateur Page d'accueuil</title>
<meta charset="utf-8">
</head>
<body>
<p>Details :</p>
<p>
<?php
if(isset($_POST['choix']))
{
if($_POST['choix'] == "1")
{
if(isset($_POST['choix1']))
{
if($_POST['choix1'] == "1")
{
if(isset($_POST['choix2']))
{
if($_POST['choix2'] == "1")
{
$choix = "Une platine en saillie en audio";
}
else if($_POST['choix2'] == "2")
{
$choix = "Une platine en saillie en vidéo";
}
else
{
echo "ERROR";
}
}
else
{
echo : "ERROR";
}
}
else if($_POST['choix1'] == "2")
{
if(isset($_POST['choix2']))
{
if($_POST['choix2'] == "1")
{
$choix = "Une platine en encastré en audio";
}
else if($_POST['choix2'] == "2")
{
$choix = "Une platine en encastré en vidéo";
}
else
{
echo "ERROR";
}
}
else
{
echo "ERROR";
}
}
else
{
echo "ERROR";
}
}
else
{
echo "ERROR";
}
}
else if($_POST['choix'] == "2")
{
if(isset($_POST['choix1']))
{
if($_POST['choix1'] == "1")
{
if(isset($_POST['choix2']))
{
if($_POST['choix2'] == "1")
{
$choix = "Deux platines en saillie en audio";
}
else if($_POST['choix2'] == "2")
{
$choix = "Deux platines en saillie en vidéo";
}
else
{
echo "ERROR";
}
}
else
{
echo "ERROR";
}
}
else if($_POST['choix1'] == "2")
{
if(isset($_POST['choix2']))
{
if($_POST['choix2'] == "1")
{
$choix = "Deux platines en encastré en audio";
}
else if($_POST['choix2'] == "2")
{
$choix = "Deux platines en encastré en vidéo";
}
else
{
echo "ERROR";
}
}
else
{
echo "ERROR";
}
}
else
{
echo "ERROR";
}
}
else
{
echo "ERROR";
}
}
else
{
echo "ERROR";
}
}
else
{
echo "Choix non référencé";
}
echo "Voux avez choisi : " .$choix;
?>
</p>
</body>
</html>
A voir également:
- Probleme PHP (if et else)
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Php alert ✓ - Forum PHP
- Php if multiple conditions ✓ - Forum PHP
- Alert PHP - Forum PHP
4 réponses
Bonjour
Pour commencer, ajoute <?php var_dump($_POST) ?> en 1ère ligne de ton script pour voir si tu reçois quelque chose
Pour commencer, ajoute <?php var_dump($_POST) ?> en 1ère ligne de ton script pour voir si tu reçois quelque chose
Tu as énormément de copier coller a première vu ne pourrais tu pas déjà diminuer le nombre de condition avec une autre logique ? Juste histoire d'alleger le code pour toi
je t'ai répondu sur ton premier sujet...
évite les doublons stp
https://forums.commentcamarche.net/forum/affich-25379019-php-probleme-avec-if-et-else#p25380965
évite les doublons stp
https://forums.commentcamarche.net/forum/affich-25379019-php-probleme-avec-if-et-else#p25380965