fabiez Posted September 27, 2014 Share Posted September 27, 2014 for($i=1; $i<=$round; $i++){ print "<tr><td align='left' valign='top'><input type='text' name='number$i' maxlength='2' size='2' /></td>\n "; print "<td align='left' valign='top'><input type='text' name='score$i' maxlength='1' size='1' /></td>\n "; print "<td align='left' valign='top'><select name='team$i'>\n"; print "<option value='-'>-<option>\n"; print "<option value='Home'>Home<option>\n"; print "<option value='Away'>Away<option>\n"; print "</select></td></tr>"; } What I'm having trouble with is that for every option tag there is an empty option tag added. How do I get rid of those empty option tags? Thankful for any help. Link to comment https://forums.phpfreaks.com/topic/291317-getting-extra-fields-in-for-loop/ Share on other sites More sharing options...
mac_gyver Posted September 27, 2014 Share Posted September 27, 2014 the problem is because your closing </option> tag is actually an opening <option> tag. Link to comment https://forums.phpfreaks.com/topic/291317-getting-extra-fields-in-for-loop/#findComment-1492233 Share on other sites More sharing options...
fabiez Posted September 27, 2014 Author Share Posted September 27, 2014 I found the problem, I didn't close it with the slash. But your right it can be an open tag. Link to comment https://forums.phpfreaks.com/topic/291317-getting-extra-fields-in-for-loop/#findComment-1492238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.