<?php session_start(); $id = $_GET["id"]; $name = $_GET["name"]; $action = $_GET["action"]; if (empty($_SESSION["people"])) { $_SESSION["people"] = array(); } $people = $_SESSION["people"]; $i = 0; echo "<p>Test: " . $people[0][0] . "</p>"; echo "<p>Before Array: "; var_dump($_SESSION["people"]); echo "</p>"; foreach ($people as $item) { echo "<p>Searching for: " . $id . "</p>"; echo "<p>Current ID: " . $item[0] . "</p>"; if ($item[0] == $id) { echo "Removing: " . $i; unset($people[$i]); } else { $i++; } } echo "<p>After Array: "; var_dump($_SESSION["people"]); echo "</p>"; $_SESSION["people"] = $people; } foreach($people as $item) { echo " <input style=\"border: 1px solid #b97819; padding: 0 2px 0 2px; border-radius: 6px;\" type=\"button\" value=\"" . $item[1] . "\" onClick=\"removeContact(" . $item[0] . ");\" /> "; ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)