Infinite Add Button + Infinite conditionals

Hello everyone,
The problem I am facing is that the client wants to have in a form buttons to add/remove infinite inputs.
The buttons will add/remove what he calls a “subtask / TO”

Each subtask has a value (in numbers) an id (in numbers) and a name (dropdown menu filled from array)

[php]TO Value:<input type=“text” name=“to1_value” size=“20” maxlength=“100” value="<? if (isset($myto1value)) echo ("$myto1value"); ?>"/>

TO#: <input type=“text” name=“to1_number” size=“5” maxlength=“10” value="<? if (isset($myto1number)) echo ("$myto1number"); ?>"/>

TO Name:<?php echo ‘’;
echo “Choose…”;
foreach ($to_name as $key => $myto1name) {
echo “<option value=”$key">$myto1name\n";
}
echo ’ ';
?>

[/php]

As you can see the inputs have some php in them. And so far I have found some JavaScript codes that only deal with duplicating html.

Each new TO/Subtask added has three variables that are pass on _POST $myto1value, $myto1number, $myto2name. These would have to be able to change dynamically according to the number of added TO/Subtask by the user.

And finally for each TO/Subtask will be a query inserting that into a mySQL table. So that part of the code needs to adapt dynamically to the number of added TO/Subtask. How can I create a conditional for variables I dont know how many there would be?

Can anyone help me out with this? Any tutorial or article or anything will be greatly appreciate it.
Thank you.

I also was interested

how many is infinate because you only have a page to do this

5 10

you will need to change the names of the selects when you do this so they have different values when they are passed to get the right information that is inserted into db

Sponsor our Newsletter | Privacy Policy | Terms of Service