编辑会话中的值

Scenario :
I have an simple php form to calculate things and calculate prices.
Now im stuck at my edit function.

  • I have a simple switch switch ($_GET['actie']) with cases like add , edit and delete.

  • This is my session : $_SESSION['data'][] = $_POST;

Edit Case :

if (isset($_POST['submitnieuw'])) 

    $data['lengtezijde'][$_GET['key']]  = $_POST['nieuw'];
    Laden(0);

Edit Form:

else

        echo $_GET['key'];
        <form action="index.php?actie=wijzigen" method="post">
        <input type="text" name="nieuw">
        <input type="submit" name="submitnieuw" value="submit">
        <input type="hidden" name="ky" value="$_GET['key;]"> 
        </form>


    break;>

i can see the key of the value i want to edit but it wont edit the $data['lengtezijde'] value

if some things are missing or my question is unclear let me know.

In your edit case you are using the GET value of the key, but from your form it looks like you should be using a POST value here instead. Try changing this:

$data['lengtezijde'][$_GET['key']]  = $_POST['nieuw'];

To this:

$data['lengtezijde'][$_POST['ky']]  = $_POST['nieuw'];