Hi all!
I am writing a PHP script. Included is a function that outputs certain information based on a given name. Here is some code
[tt]$family[/tt] is a given variable.
My problem is this: When I first run the function, everything prints fine. The next times, for some reason, [tt]$family[/tt] defaults to the value of the first time passed, except when called the last time. I tried echoing it separately and it returned the correct value; in fact, I have tried everything I could think of. Any ideas?
--Chessbot
"Violence is the last refuge of the incompetent." -- Asimov, Foundation
I am writing a PHP script. Included is a function that outputs certain information based on a given name. Here is some code
Code:
echo "<tr>";
echo "<td><input type=\"text\" name=\"" . $family . "_firstname\"></td>";
echo "<td><input type=\"text\" name=\"" . $family . "_lastname\" value=\"{$lastname}\"></td>";
echo "<td><input type=\"text\" name=\"familyname\" value=\"" . $family . "\"></td>";
foreach ($fields as $field)
{
echo "<td>";
echo "<select name=\"" . $family . "_{$field}\">";
echo "<optgroup class=\"indefinite\">";
echo "<option value=\"e\">Expected to come</option>";
echo "<option value=\"f\">Expected not to come</option>";
echo "</optgroup>";
echo "<option value=\"y\">Coming</option>";
echo "<option value=\"n\">Not coming</option>";
echo "<option value=\"x\">Not invited</option>";
echo "</select>";
echo "</td>";
}
echo "<td>";
echo "<select name=\"" . $family . "_group\">";
echo "<option value=\"c\">Child</option>";
echo "<option value=\"t\">Teenager</option>";
echo "<option value=\"a\">Adult</option>";
echo "</select>";
echo "</td>";
echo "<td><a href=\"#\" onclick=\"submitForm(this,'insert', '{$family}');\">Add</a></td>";
echo "</form>";
echo "</tr>";
My problem is this: When I first run the function, everything prints fine. The next times, for some reason, [tt]$family[/tt] defaults to the value of the first time passed, except when called the last time. I tried echoing it separately and it returned the correct value; in fact, I have tried everything I could think of. Any ideas?
--Chessbot
"Violence is the last refuge of the incompetent." -- Asimov, Foundation