Maybe this is a stupid question, but I was wondering if I could get information passed with a form into a for-loop.
The problem is as follows:
The passing of the information works, though he passes only for the last loop. For example if I click the submit button for loop 2 ($i = 2)
. The command $_POST['titel']
will only remember the information in last loop ($i = $numact-1)
and not loop 2 ($i = 2)
.
for example if titel[0] = test0, titel[1] = test1, titel[2] = test2. and I click the submit button below titel[0]
he passes the information from titel[2]
. Is there an easy way to get around this?
I have the following code (For the sake of simplicity I shortened it);
<?php
for ($i = 0; $i <= $numact-1; $i++) {
echo "<tr><td width='150'>
<input type='text' name='titel' value='$titel[$i]' />
</td></tr>
<tr><td><input type='submit' name='submitreg' value='Toon activiteit'/>
</td></tr>";
}
?>