www.webdeveloper.com
Results 1 to 3 of 3

Thread: Question about HTML and PHP Arrays

  1. #1
    Join Date
    Jul 2008
    Posts
    10

    Question about HTML and PHP Arrays

    PHP Code:
    echo '<td><input name="id[]" type="text"  size="5" value =" ' $pending['id'] . ' "  /></td> ';
    echo 
    '<td><input name="id[]" type="text" size="20"  value =" ' $pending['cds'] .' "/></td> '
    it produces this:
    (
    [0] => 2007
    [1] => 12
    [2] => 3434
    [3] => 67
    )

    i want something like this:
    Array
    (
    [0] => Array
    (
    [0] => 2007
    [1] => 12
    )
    [1] => Array
    (
    [0] => 3434
    [1] => 67
    )
    )

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,529
    You could do:
    Code:
    <input name="id[0][]" . . . >
    <input name="id[0][]" . . . >
    <input name="id[1][]" . . . >
    <input name="id[1][]" . . . >
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jul 2008
    Posts
    10
    Not quite i suppose.here is more info:
    the id and cds gets pulled from the database. I then want to create and array like this where one entry of the id and cd produces this:
    [0] => Array
    (
    [0] => 2007
    [1] => 12
    )
    then the next entry:
    [1] => Array
    (
    [0] => 3434
    [1] => 67
    )

    and so on

    When i try that code, it generates two separate arrays and not one combine one

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles