Welcome Guest, Not a member yet? Register   Sign In
Form repopulation and arrays
#1

[eluser]Treeda[/eluser]
Hi all,

just a question...

normally i avoid array as field names in forms but i want to try again and stumbled over a prob

in a form btw i'm using smarty, but this shouldn't be a problem i think

Code:
<input name="test[]" value="{'test[]'|set_value}" type="text">
<input name="test[]" value="{php}echo set_value('test[]'); {/php}" type="text">

i have this 2 lines for testing.

in the script i have
Code:
$this->form_validation->set_rules('test[]', 'testing', '');

what happens after i submit the form is that the input fields above conain the text "Array".

i don't know how but as it is described in the manual it should magically repopulate the correct indexes with the correct values or am i wrong? if not, well then what is it for?

i would very much appreciate help to get this going.

the only alternative way i see (not tested yet) is generating the index directly or simply don't use array but test_1 test_2 test_3 etc. would like to avoid that.

Treeda
#2

[eluser]Flemming[/eluser]
EDIT: see below
#3

[eluser]Colin Williams[/eluser]
Heavens. I wish we could vote replies here up or down.

The real problem, Treeda, is that you need to actually access an index of the test array. For example, test[0] or test[1], and so on.
#4

[eluser]Flemming[/eluser]
hmmm... after re-reading my reply I'm voting it down!




Theme © iAndrew 2016 - Forum software by © MyBB