> I've built a page that collects network card information, assigning each
> element its place within a $Card array, and all of the cards to $NetCards.
> As you enter your card information at the bottom, the previous card is
> displayed above it, with a Delete checkbox option at the end of that row
> ($Delete[$Card]).
>
> But I can't figure out how to actually delete that card from the "deck",
> as it were. I've looked over the Arrays pages, but there's little there
> about multi-dimensional arrays and I ended up more confused than ever.
> Here's my print_r:
>
> Array   <=---  This is $NetCards
> (
>     [0] => Array                                <=--- This one is just
> $Card
>         (
>             [0] => 3Com                         <=--- Description
>             [1] => 12:34:45:78:90:AA    <=--- MAC Address
>             [2] => 129.93.100.100               <=--- IP  Address
>         )
>
>     [1] => Array
>         (
>             [0] => Intel 100b
>             [1] => 12:34:45:78:90:AB
>             [2] => 129.93.100.101
>         )
>
>     [2] => Array
>         (
>             [0] => ThinAire
>             [1] => 12:34:45:78:90:BB
>             [2] => 129.93.100.102
>         )
>
>     [3] => Array
>         (
>             [0] => 3Com
>             [1] => 12:34:45:78:90:BC
>             [2] => 129.93.100.103
>         )
>
> )
>
> How can I delete, say, the wireless card (ThinAire) which is third, here,
> if someone clicks on that one's Delete box? Thanks!

Assuming you somehow already get the "2" value when the user checks the
checkbox, you'd simply call

unset($NetCards[2]);

to get rid of the "ThinAire" card. If you're also looking for help making
the checkboxes, let me know.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to