1
I need to create a form dynamically, with checkboxes created in a for loop. Everything works fine on my localhost. However, when I transfer the code to the server I get problems: The form will show the correct number of checkboxes, but they all contain data from the last entry in the list. Code:
$form = new XoopsThemeForm('My form ', 'myName', $myPath, POST);
for ($i=0;$i<count($members);$i++)
{
$member = $members[$i];
$name = $member->Name();
echo $name // This shows the correct name in both cases
$isPresent = isPresent($member->ID());
$checkbox = new XoopsFormCheckBox($name, $member->ID(), $isPresent);
$checkbox->addOption(false, " ");
echo $checkbox; // this is OK on the localhost, and empty on the server
$form->addElement($sjekkboks);
}
$form->addElement(new XoopsFormButton("", 'someName', 'Save','submit' ));
$form->Display();
This will show the form with count($members) instances of the checkbox. On my localhost everything is fine, but on the server they're all filled with data from the last member.
Any idea, anyone?
(Note: we're not talking XOOPS members here, the member class is my own).