caddie juste pour lister et supprimer mes produits

Eléphant du PHP | 161 Messages

25 juil. 2016, 12:41

salut a tous,
j'ai un probleme serieux, et je suis certain quelqu'un ici pourrai bien m'aider
j'ai mon panier qui ne fonctionne pas comme il le faut.
tout d'abort je presente a quoi ressemble ein Produit et les champs qui son a remplir,
http://www.bilder-upload.eu/show.php?fi ... 173366.png
jusqu'ici lorsque je remplis les champs et que j'appuis sur speicher (sauvegarder) cela marche sans
probleme, malheureusement le code ne m'affiche pas ma liste comme j'attend et je ne sais pas
si quelqu'un pourrai me venir en aide.
en voici tous mes codes des rapport avec mon panier
panier.php
https://gist.github.com/anonymous/577a4 ... 47c8cf13db
addCaddie.php
https://gist.github.com/anonymous/14272 ... 8695ac0ed8
supprimerdupanier.php
https://gist.github.com/anonymous/a5c92 ... 5b42cb6dd1

Si vous plait j'ai besoin d'un coup de main merci bien.

Avatar du membre
Administrateur PHPfrance
Administrateur PHPfrance | 9783 Messages

25 juil. 2016, 18:10

Bonjour,
malheureusement le code ne m'affiche pas ma liste comme j'attend
Avec une description aussi vague du problème ça va être dur de t'aider.

Qu'est-ce qui ne marche pas ?
Qu'as-tu essayé ?
Quels sont les messages d'erreurs ?
Quand tout le reste a échoué, lisez le mode d'emploi...

Eléphant du PHP | 161 Messages

25 juil. 2016, 20:12

lorsque je rempli tous les champs et appuis sur sauvegarder(speichern) javascript me comfirme bien que les donnees ont ete sauvegarde et on peut bien les voire
dans ma base de donnees malheureusement au niveau de la page panier.php on ne voit rien. C#est la mon Probleme et j'ai deja change mon code panier.php malheureusement toujours rien. et dans mon mon error_log il n'ya aucune erreur a signaler.

Ce que je dois encore revois est ma requette sql qui me permet d'ajoute les choix d'un utilisateur dans son panier, car il faut que je mentionne bien qu'une image peut etre choisi plusiuers fois mais avec des parametres different, la j'ai utiliser update et lorsque je choisi une image pour une seconde fois et j'entre des parameters different que ceux precedent les nouveaux parametres ecrasent ce qui existe deja, et la c'est clair car j'ai utiliser update.

Eléphant du PHP | 161 Messages

26 juil. 2016, 08:32

j'espere que j'ai pu dire quelque chose d'interessant sinon, s'il ya des question ne pas exiter de poser

Avatar du membre
Administrateur PHPfrance
Administrateur PHPfrance | 9783 Messages

26 juil. 2016, 10:15

Il faut que tu ailles plus loin dans ton debug pour savoir où ça bloque techniquement.
Met des points d'arrêts, ou de simples die("debug ") et suit l'exécution de ton code en cherchant à quel moment ça ne fonctionne plus comme tu as prévu.
Quand tout le reste a échoué, lisez le mode d'emploi...

Avatar du membre
Modérateur PHPfrance
Modérateur PHPfrance | 8758 Messages

26 juil. 2016, 10:24

salut,

tu n'as pas de session_start sur ton script d'affichage c'est normal ?

J'ai testé ton code en ajoutant une init des données et il est quais fonctionnel. Le seul problème c'est que tu te base sur un index qui n'est pas celui du tableau d'origine pour ton lien de suppression du coup y a un moment ça déconne.
en dehors de cela tu affiches les données du tableau et peu les supprimer.

J'ai corrigé ton code pour éviter cela et travailler directement sur le tableau de session histoire d'éviter les intermédiaires inutiles.
Le tableau d’initialisation au début c'est pour tester il faut bien sur utiliser un tableau vide.
Il faut que tu vire les 650 lignes de css de fichier pour les mettre dans un fichier css à part. Non seulement cela permet le réemploi plutôt que la duplication et en plus cela facilite la lecture de fichier.
Pour info la mise en page en tableau c'est pas terrible tu peux faire la même chose en css de façon fluide (voir même responsive si tu veux). La dernière chose à la mode pour cela c'est flebox.

J'ai réduit la suppression au strict nécessaire
<?php
session_start();
unset($_SESSION['panier'][$_GET['index']]);
header("location:test.php?panier=1");
La page d'affichage.
<?php
//    require_once 'connection.php';
session_start();
if (!isset($_SESSION['panier']) || !is_array($_SESSION['panier'])) {
    $_SESSION['panier'] = [['id_pho' => 1, 'code_cat' => 'osef', 'photo' => 'photo1'],
        ['id_pho' => 2, 'code_cat' => 'osef2', 'photo' => 'photo2'],
        ['id_pho' => 3, 'code_cat' => 'osef3', 'photo' => 'photo3'],
        ['id_pho' => 4, 'code_cat' => 'osef4', 'photo' => 'photo4'],
        ['id_pho' => 5, 'code_cat' => 'osef5', 'photo' => 'photo5'],
        ['id_pho' => 6, 'code_cat' => 'osef6', 'photo' => 'photo6'],
        ['id_pho' => 7, 'code_cat' => 'osef7', 'photo' => 'photo7'],
        ['id_pho' => 8, 'code_cat' => 'osef8', 'photo' => 'photo8'],
        ['id_pho' => 9, 'code_cat' => 'osef9', 'photo' => 'photo9'],
        ['id_pho' => 10, 'code_cat' => 'osef10', 'photo' => 'photo10']];
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <style type="text/css">
        html {
            font-family: Calibri, Arial, Helvetica, sans-serif;
            font-size: 11pt;
            background-color: white
        }

        table {
            border-collapse: collapse;
            page-break-after: always
        }

        .gridlines td {
            border: 1px dotted black
        }

        .b {
            text-align: center
        }

        .e {
            text-align: center
        }

        .f {
            text-align: right
        }

        .inlineStr {
            text-align: left
        }

        .n {
            text-align: right
        }

        .s {
            text-align: left
        }

        td.style5 {
            vertical-align: middle;
            text-align: left;
            padding-right: 0px;
            border-bottom: 2px solid #000000 !important;
            border-top: 2px solid #000000 !important;
            border-left: 3px solid #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style6 {
            vertical-align: middle;
            border-bottom: none #000000;
            border-top: none #000000;
            border-left: none #000000;
            border-right: none #000000;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: white
        }

        td.style7 {
            vertical-align: middle;
            text-align: left;
            padding-right: 0px;
            border-bottom: 3px solid #000000 !important;
            border-top: 2px solid #000000 !important;
            border-left: 2px solid #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style8 {
            vertical-align: middle;
            text-align: left;
            padding-right: 0px;
            border-bottom: none #000000;
            border-top: 2px solid #000000 !important;
            border-left: 3px solid #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style9 {
            vertical-align: middle;
            text-align: left;
            padding-right: 0px;
            border-bottom: none #000000;
            border-top: 2px solid #000000 !important;
            border-left: 2px solid #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style40 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 1px solid #000000 !important;
            border-top: 3px solid #000000 !important;
            border-left: 1px dashed #BFBFBF !important;
            border-right: 1px dashed #BFBFBF !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: white
        }

        td.style41 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 0px solid #000000 !important;
            border-top: 3px solid #000000 !important;
            border-left: 0px dashed #BFBFBF !important;
            border-right: 0px solid #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: white
        }

        td.style42 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 0px solid #000000 !important;
            border-top: 3px solid #000000 !important;
            border-left: 0px dashed #BFBFBF !important;
            border-right: 0px solid #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: white
        }

        td.style43 {
            vertical-align: middle;
            text-align: center;
            border-bottom: none #000000;
            border-top: 2px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style44 {
            vertical-align: middle;
            text-align: center;
            border-bottom: none #000000;
            border-top: 2px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 2px solid #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style45 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 3px solid #000000 !important;
            border-top: 2px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style46 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 3px solid #000000 !important;
            border-top: 2px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 2px solid #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style47 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 3px solid #000000 !important;
            border-top: 2px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 3px solid #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style48 {
            vertical-align: middle;
            text-align: center;
            border-bottom: none #000000;
            border-top: 3px solid #000000 !important;
            border-left: 3px solid #000000 !important;
            border-right: none #000000
        }

        td.style49 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 3px #000000;
            border-top: 3px solid #000000 !important;
            border-left: none #000000;
            border-right: none #000000;
            margin-left: 3px;
            background-color: #D8D8D8
        }

        td.style52 {
            vertical-align: middle;
            text-align: center;
            border-bottom: none #000000;
            border-top: 3px solid #000000 !important;
            border-left: 2px solid #000000 !important;
            border-right: none #000000;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 19pt;
            background-color: #D8D8D8
        }

        td.style54 {
            vertical-align: middle;
            text-align: center;
            border-bottom: none #000000;
            border-top: 3px solid #000000 !important;
            border-left: none #000000;
            border-right: 2px solid #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 19pt;
            background-color: #D8D8D8
        }

        td.style58 {
            vertical-align: middle;
            text-align: center;
            border-bottom: none #000000;
            border-top: 3px solid #000000 !important;
            border-left: none #000000;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style59 {
            vertical-align: middle;
            text-align: center;
            border-bottom: none #000000;
            border-top: 3px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style60 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 2px solid #000000 !important;
            border-top: none #000000;
            border-left: none #000000;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style61 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 2px solid #000000 !important;
            border-top: none #000000;
            border-left: 1px dashed #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style62 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 1px solid #000000 !important;
            border-top: 3px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 3px solid #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style63 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 2px solid #000000 !important;
            border-top: 1px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 3px solid #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style64 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 2px solid #000000 !important;
            border-top: 2px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style65 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 2px solid #000000 !important;
            border-top: 2px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 2px solid #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style66 {
            vertical-align: middle;
            text-align: right;
            padding-right: 0px;
            border-bottom: 2px solid #000000 !important;
            border-top: 2px solid #000000 !important;
            border-left: 2px solid #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style67 {
            vertical-align: middle;
            text-align: left;
            padding-right: 0px;
            border-bottom: 2px solid #000000 !important;
            border-top: 2px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 1px dashed #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        td.style68 {
            vertical-align: middle;
            text-align: center;
            border-bottom: 2px solid #000000 !important;
            border-top: 2px solid #000000 !important;
            border-left: 1px dashed #000000 !important;
            border-right: 3px solid #000000 !important;
            font-weight: bold;
            color: #000000;
            font-family: 'Calibri';
            font-size: 11pt;
            background-color: #D8D8D8
        }

        table.sheet0 col.col0 {
            width: 88.78888787pt
        }

        table.sheet0 col.col1 {
            width: 45.41111059pt
        }

        table.sheet0 col.col2 {
            width: 45.41111059pt
        }

        table.sheet0 col.col3 {
            width: 72.52222139pt
        }

        table.sheet0 col.col4 {
            width: 49.47777721pt
        }

        table.sheet0 col.col5 {
            width: 32.53333296pt
        }

        table.sheet0 col.col6 {
            width: 72.52222139pt
        }

        table.sheet0 col.col7 {
            width: 45.41111059pt
        }

        table.sheet0 col.col8 {
            width: 45.41111059pt
        }

        table.sheet0 col.col9 {
            width: 51.51111052pt
        }

        table.sheet0 col.col10 {
            width: 49.47777721pt
        }

        table.sheet0 col.col11 {
            width: 33.21111072999999pt
        }

        table.sheet0 tr {
            height: 15pt
        }

        table.sheet0 tr.row0 {
            height: 33.6pt
        }

        table.sheet0 tr.row1 {
            height: 33.6pt
        }

        table.sheet0 tr.row2 {
            height: 33.6pt
        }

        table.sheet0 tr.row3 {
            height: 33.6pt
        }

        table.sheet0 tr.row4 {
            height: 34.9pt
        }

        table.sheet0 tr.row5 {
            height: 25.15pt
        }

        table.sheet0 tr.row6 {
            height: 25.15pt
        }

        table.sheet0 tr.row7 {
            height: 25.15pt
        }

        table.sheet0 tr.row8 {
            height: 25.15pt
        }

        table.sheet0 tr.row9 {
            height: 25.9pt
        }

        table.sheet0 tr.row10 {
            height: 25.9pt
        }

        table.sheet0 tr.row11 {
            height: 25.9pt
        }

        table.sheet0 tr.row12 {
            height: 25.9pt
        }

        table.sheet0 tr.row13 {
            height: 25.9pt
        }

        table.sheet0 tr.row14 {
            height: 25.9pt
        }

        table.sheet0 tr.row15 {
            height: 25.9pt
        }

        table.sheet0 tr.row16 {
            height: 25.9pt
        }

        table.sheet0 tr.row17 {
            height: 34.9pt
        }

        table.sheet0 tr.row18 {
            height: 25.15pt
        }

        table.sheet0 tr.row19 {
            height: 25.15pt
        }

        table.sheet0 tr.row20 {
            height: 25.15pt
        }

        table.sheet0 tr.row21 {
            height: 25.15pt
        }

        table.sheet0 tr.row22 {
            height: 25.9pt
        }

        table.sheet0 tr.row23 {
            height: 25.9pt
        }

        table.sheet0 tr.row24 {
            height: 25.9pt
        }

        table.sheet0 tr.row25 {
            height: 25.9pt
        }

        table.sheet0 tr.row26 {
            height: 25.9pt
        }

        table.sheet0 tr.row27 {
            height: 25.9pt
        }

        table.sheet0 tr.row28 {
            height: 25.9pt
        }

        table.sheet0 tr.row29 {
            height: 25.9pt
        }

        table.sheet0 tr.row30 {
            height: 34.9pt
        }

        table.sheet0 tr.row31 {
            height: 25.15pt
        }

        table.sheet0 tr.row32 {
            height: 25.15pt
        }

        table.sheet0 tr.row33 {
            height: 25.15pt
        }

        table.sheet0 tr.row34 {
            height: 25.15pt
        }

        table.sheet0 tr.row35 {
            height: 25.9pt
        }

        table.sheet0 tr.row36 {
            height: 25.9pt
        }

        table.sheet0 tr.row37 {
            height: 25.9pt
        }

        table.sheet0 tr.row38 {
            height: 25.9pt
        }

        table.sheet0 tr.row39 {
            height: 25.9pt
        }

        table.sheet0 tr.row40 {
            height: 25.9pt
        }

        table.sheet0 tr.row41 {
            height: 25.9pt
        }

        table.sheet0 tr.row42 {
            height: 25.9pt
        }
    </style>
    <style type="text/css">
        @page {
            left-margin: 0.7086614173228347in;
            right-margin: 0.7086614173228347in;
            top-margin: 0.7874015748031497in;
            bottom-margin: 0.7874015748031497in;
        }

        body {
            left-margin: 0.7086614173228347in;
            right-margin: 0.7086614173228347in;
            top-margin: 0.7874015748031497in;
            bottom-margin: 0.7874015748031497in;
        }
    </style>
</head>
<body>

<div>
    <form method="post" action="formular2.php">
        <table border="0" cellpadding="0" cellspacing="0" id="sheet0" class="sheet0 gridlines" align="center"
               width="98%">
            <col class="col0">
            <col class="col1">
            <col class="col2">
            <col class="col3">
            <col class="col4">
            <col class="col5">
            <col class="col6">
            <col class="col7">
            <col class="col8">
            <col class="col9">
            <col class="col10">
            <col class="col11">
            <tbody>
            <tr class="row0">
                <td class="column0 style48 s style49" colspan="3"></td>
                <td class="column3 style52 s style54" colspan="6">Kantteilbestellung</td>
                <td class="column9 style58 s style59" colspan="2">Seite:</td>
                <td class="column11 style62 s style62">/</td>
            </tr>
            <tr class="row2">
                <td class="column0 style5 s">Bauvorhaben:</td>
                <td class="column1 style64 s style65" colspan="6"><input type="text" name="bauvorhaben" size="40"
                                                                         maxlength="40" required="required"></td>
                <td class="column7 style66 s style67" colspan="2">Auftrags-Nr.:</td>
                <td class="column9 style64 s style68" colspan="3"><input type="text" name="auftrags_nr" size="10"
                                                                         maxlength="8" required="required"></td>
            </tr>
            <tr class="row3">
                <td class="column0 style8 s">Fassade:</td>
                <td class="column1 style43 s style44" colspan="2"><input type="text" name="fassade" size="10"
                                                                         maxlength="6" required="required"></td>
                <td class="column3 style9 s">Bearbeiter:</td>
                <td class="column4 style43 s style44" colspan="2"><input type="text" name="bearbeiter" size="15"
                                                                         maxlength="13" required="required"></td>
                <td class="column6 style7 s">Datum:</td>
                <td class="column7 style45 n style46" colspan="2"><input type="text" name="datum" size="10"
                                                                         maxlength="8" required="required"></td>
                <td class="column9 style7 s">Termin:</td>
                <td class="column10 style45 n style47" colspan="2"><input type="text" name="termin" size="10"
                                                                          maxlength="8" required="required"></td>
            </tr>
            <tr class="row4">
                <td class="column1 style40 n style42" colspan="2"></td>
                <td class="column4 style40 n style41" colspan="2"></td>
                <td class="column7 style40 n style42" colspan="2"></td>
            </tr>
            </tr>
            </tbody>
        </table>
</div>
<div id="listeProduits" align="center">
    <table border="1">
        <tr>
            <th colspan="4"><h4>Hier ist die Liste Ihrer ausgew�lten Kantteile</h4></th>
        </tr>
        <tr align="center">
            <th>BILD-ID</th>
            <th>KATEGORIE-ID</th>
            <th>BILDPFAD</th>
            <th></th>
        </tr>
        <?php
        foreach ($_SESSION['panier'] as $key => $value) {
            echo <<<html
	        <tr>
		         <td>{$value['id_pho']}</td>
		         <td>{$value['code_cat']}</td>
		         <td>{$value['photo']}</td>
		         <td><a href="supprimerdupanier.php?index={$key}">L�schen</a></td>
	        </tr>
html;
        }
        ?>
    </table>
</div>
<input style="margin-top:25px" type="image" src="images/obj_pdf.gif" alt="Abschiken">
</form>
</body>
</html>

Si avec tous ça rien ne s'affiche c'est que tu n'alimentes pas le tableau de session $_SESSION['panier']
La forme la plus simple fonctionnelle de "addCaddie.php" est celle ci
<?php
session_start();
if(!isset($_SESSION['panier']) || !is_array($_SESSION['panier'])){
    $_SESSION['panier'] = [];
}
$_SESSION['panier'][] = ['photo'=>$_POST['photo'], 'code_cat'=>$_POST['code_cat'],'id_pho'=>$_POST['id_pho']];
header("location:index.php?panier=1");
Il est impératif de valider les données reçus des formulaires avant de les employer. cela manque sur tout tes fichiers "d'action" (ajout suppression).

@+
Il en faut peu pour être heureux ......

Eléphant du PHP | 161 Messages

26 juil. 2016, 14:10

Salut Moogli,
merci bien des conceils , j'ai fait un script pour le css.

en ce qui concerne, l'affichage du contenu de mon panier il ne marche malheureusement pas.
je me suis deja donne de la peine a voire comment est ce que je pouvais modifier ton code malheureusement ca ne me reussi pas.

en ce qui concerne l'alimentation du tableau de session $_SESSION['panier'] , a quel niveau es ce que je me trompe donc alors?

SVP.
Merci d'avance

Avatar du membre
Modérateur PHPfrance
Modérateur PHPfrance | 8758 Messages

26 juil. 2016, 14:32

as tu essayés le code de la page d'ajout de mon message précédent
<?php
session_start();
if(!isset($_SESSION['panier']) || !is_array($_SESSION['panier'])){
    $_SESSION['panier'] = [];
}
$_SESSION['panier'][] = ['photo'=>$_POST['photo'], 'code_cat'=>$_POST['code_cat'],'id_pho'=>$_POST['id_pho']];
header("location:index.php?panier=1");
ce code permet d'ajouter une ligne dans le tableau en session avec les informations qui sont dans le formulaire, après on a pas le formulaire pour voir si tout va ben.
Il faut tester fichier par fichier.
Commence par le formulaire qui a pour cible "addCaddie.php", met en commentaire le header et ajoute un var_dump($_SESSION) en dessous.

tu dois voir ta saisie dans le tableau de session.

@+
Il en faut peu pour être heureux ......

Eléphant du PHP | 161 Messages

26 juil. 2016, 14:57

Moogli,
juste pour te certifier que j'ai fait le shot screen addCaddie.php http://de.share-your-photo.com/df4100f4c8
en ce qui concerne var_dump($_SESSION) il ne me livre rien, c'est la ou je suis totalement suppris car les donnees sont bien sauvegarde
et on peu bien les voire dans la base de donnees et le error_log est vide .

Avatar du membre
Modérateur PHPfrance
Modérateur PHPfrance | 8758 Messages

26 juil. 2016, 15:51

il y a forcément un truc au milieu de tous cela.
Tu parles de base de données c'est donc qu'il y a un autre processus en plus de celui ci est ce qu'il n'écraserait pas la variable ?


un var_dump($_SESSION) doit au moins afficher : array(0) { }
<?php
session_start();
var_dump($_SESSION);
if(!isset($_SESSION['panier']) || !is_array($_SESSION['panier'])){
    $_SESSION['panier'] = [];
}
$_SESSION['panier'][] = ['photo'=>$_POST['photo'], 'code_cat'=>$_POST['code_cat'],'id_pho'=>$_POST['id_pho']];
var_dump($_SESSION);
ça affiche quoi ?
Il en faut peu pour être heureux ......

Eléphant du PHP | 161 Messages

26 juil. 2016, 16:20

c'est exactement ce que j'ai fait comme sur ce shot screen http://de.share-your-photo.com/65ebc76b5f malheureusemnt il ne m'affiche rien.

Avatar du membre
Modérateur PHPfrance
Modérateur PHPfrance | 8758 Messages

26 juil. 2016, 16:57

il y a forcément quelque chose d'affiché. S'il n'y a rien dans le tableau de session tu auras : array(0) { }

si tu n'as pas de session_start tu auras
Notice: Undefined variable: _SESSION in /dev/wsphp/test.php on line 4
NULL

tu dois donc forcément avoir quelque chose d'affiché.

est tu certain de passer dans ce fichier ?

@+
Il en faut peu pour être heureux ......

Avatar du membre
Modérateur PHPfrance
Modérateur PHPfrance | 8758 Messages

27 juil. 2016, 12:58

Comment fait tu pour accéder au fichier ?
je n'ai pas trouver de trace d'appel au fichier addCaddie.php dans le code.
Si c'est direct dans le navigateur alors tu ne peux pas utiliser $_POST mais $_GET (avec les paramètres dans l'url).

@+
Il en faut peu pour être heureux ......

Eléphant du PHP | 161 Messages

27 juil. 2016, 15:19

Merci bien,
je vais devoir revoir tous mes scripts.
@+

Eléphant du PHP | 161 Messages

28 juil. 2016, 11:50

j'ai essaye de modifier avec $_GET malheureusemnt ca ne marche toujours pas