03-04-2008, 01:07 PM
|
#1 (permalink)
|
|
The Wanderer
Join Date: Nov 2007
Location: Edinburgh
Posts: 21
Thanks: 1
|
Counting for 1 ++
Iv got a really stupid problem, iv created a dynamic form, where the inputs can be added / removed by the user.
However i need to name each input uniquely, I.E textbox1, textbox2, textbox3 on and on...
The code i have for generating the textbox is this;
Code:
$form = new build_form;
foreach($_SESSION['form'] as $element){
if(strlen($element) > 0){
$form->$element('', 'name');
}
}
basicly its getting the elements and functions from my class, it works perfect, i just need a way to name with a number at the end, which will go up 1 for every input added.
How to do this? I managed to get it so it was putting in 2 textboxes ( when it should only be doing 1 ) and was naming them name1, name2 but then the next two that came in where also name1 and name2
|
|
|
|