只是想知道我在这里做错了什么。我有以下HTML表格供Codeigniter使用,有几个下拉列表。
除了第一个SELECT元素之外,我不能单击任何输入框而不跳转到原始的SELECT下拉列表,其他SELECT下拉列表仅在我跳回到第一个SELECT下拉列表之前暂时显示结果。
我猜我在循环中为第一个SELECT下拉做了一些非常简单的错误,但我看不到它。
NB。此外,源代码是完全正确的 - 只是表单的行为不是......
有什么想法吗?
<!-- Admin Products -->
<div>
<?php if(COUNT($form) > 0):?>
<?php for($i = 0;$i < COUNT($form);$i++):?>
<div id="message"></div>
<?=validation_errors()?>
<?=form_open('admin/form/' . $this->uri->segment(3))?>
<fieldset>
<legend>Fill in form</legend><br>
<input name="id" type="hidden" value="<?=$form[$i]['id']?>"><br>
<input name="strId" size="30" type="text" value="<?php echo set_value('strId');?>"><br>
<label><?=$form[$i]['text_name']?>
<select name="line">
<?php if(COUNT($lines) > 0):?>
<?php for($x = 0;$x < COUNT($lines);$x++):?>
<option><?=$lines[$x]['line']?></option>
<?php endfor;?>
<?php endif;?>
</select><br>
<input name="new_line" size="30" type="text" value="<?php echo set_value('new_line');?>"><br>
<select name="product">
<?php if(COUNT($products) > 0):?>
<?php for($y = 0;$y < COUNT($products);$y++):?>
<option><?=$products[$y]['product']?></option>
<?php endfor;?>
<?php endif;?>
</select><br>
<label>New product
<input name="new_product" size="30" type="text" value="<?php echo set_value('new_product');?>"><br>
<input name="size" size="30" type="text" value="<?php echo set_value('size');?>"><br>
<input name="unit" size="30" type="text" value="<?php echo set_value('unit');?>"><br>
<label><?=$form[$i]['brand_brandName']?>
<select name="brand">
<?php if(COUNT($brands) > 0):?>
<?php for($z = 0;$z < COUNT($brands);$z++):?>
<option><?=$brands[$z]['brand']?></option>
<?php endfor;?>
<?php endif;?>
</select><br>
<label>New brand
<input name="new_brand" size="30" type="text" value="<?php echo set_value('new_brand');?>"><br><br>
<input type="submit" value="Submit">
</fieldset><!-- End of fieldset tag -->
</form><!-- End of form tag -->
<?php endfor;?>
<?php endif;?>
</div><!-- End Admin Products -->
答案 0 :(得分:2)
您可能必须关闭标签代码:<label></label>