SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    at home
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question multidimensional associative arrays and operations

    Hi,

    I am using multidimensional associative arrays to hold data from multiple form submissions. I have an array like:

    array named $forms with parts:

    'VendorName'
    'Address'
    'Amount'

    Up to five of each.

    I need to be able to delete one of the "records" or indices from any part of the array and have the rest "close up". So that, if I had say 5 records, and if the third indices and form data is removed, then I still end up with 4 "records".

    I am not holding this in a db. I pass the array in a session variable between pages.

    Also, in an echo statement, it seems like I have to put the array elements in braces to get them to print, like:

    echo " {$forms['Name'][1]} <br> ";

    Does that make sense? I thought the double quotes would evaluate what is inside.

    TIA

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    at home
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    loading form data back into a web page for editing

    oops no reply here

  3. #3
    Maniacally depressed robot poncho's Avatar
    Join Date
    Dec 2004
    Location
    Belfast, N.Ireland
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using the unset statement:
    PHP Code:
    unset($forms['Name'][3]); 
    Cheers;
    Poncho
    Perfecting the art of breaking stuff.
    Check 'em: CakePHP | TextMate


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •