Women in Technology

Hear us Roar

  Autofilled PHP Forms
Subject:   Problem with using array input names
Date:   2006-07-06 23:47:19
From:   sdave1284
Hey great script! This will save so much time. Now I just have to go back and get all my old scripts to use it. I did run into one problem and I wanted to see if you may have a solution....

If you have input fields like the following:

<input type="text" name="phone1[1]" id="phone1[1]">-
<input type="text" name="phone2[1]" id="phone2[1]">-
<input type="text" name="phone3[1]" id="phone3[1]">

It will not fill in the values. I guess it doesnt recognize how to fill in an array of values with <? echo $_POST['phone1'][1] ?>, etc....

Any ideas how I could modify the script or if its possible??

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Problem with using array input names
    2006-07-07 16:12:06  GavinAndresen [View]

    I was wondering when somebody would notice that it doesn't handle PHP's built-in support for arrays of form fields.

    On a scale of 1-10, that will be about a '6' to fix; it will involve changes to the fillInInputTag() and fillInTextArea() (and maybe fillInSelect) functions, where they fetch the "name" attribute (gotta be smarter about name="foo[]", and keep track of which array index is being parsed, and find the corresponding value in $request).