[SOLVED] Starting a loop within an IF statement.
Posted: Thu Feb 08, 2007 6:42 am
I want some code that starts a loop depending on a _GET value. I want it to start with if a _GET value is a certain value and run if it's anything else. I'm getting an "unexpected T_ELSE" error at the moment with this code:
Any ideas here? Its as if PHP is getting confused with the opening brace within the IF loop.
Regards,
Code: Select all
for ($i = 1; $i < 21; $i++) {Code: Select all
for ($i = 1; $i < 11; $i++) {Code: Select all
if (isset($_GET["addMore"])) {
for($i = 1; $i < 21; $i++) {
}
else {
for ($i = 1; $i < 11; $i++) {
}
if ($i > 9) {
echo "$i<input type = 'text' name = 'groupCont{$i}' size = '50'> <br>";
}
else {
echo "$i <input type = 'text' name = 'groupCont{$i}' size = '50'> <br>"; }
}
echo "</td> </tr> <tr> <td colspan = '2' bgcolor = '$col'>";
echo "<center> <input type = 'submit' value = 'Add Group'>";
echo "</td> </tr>";
echo "</form>";
echo "</table>";
}Regards,