Problem with a drop down menu, help appreciated

The drop down menu is not showing the things it should, code is

							<?php echo form_label(lang('tips_select_sport') . lang('bf_form_label_required'), 'sport_id', array('class' => 'control-label')); ?>
							<select name="sport_id" id="sport_id" class="form-control">
								<option value=""><?php echo lang('tips_select_sport');?></option>
								<?php foreach ($sports->result() as $row) {
									$sel = ($row->id==set_value('sport_id'))?'selected="selected"':'';
									?>
									<option value="<?php echo $row->id;?>" <?php echo $sel;?>><?php echo $row->name;?></option>
								<?php }?>
							</select>
							<span class='help-block'><?php echo form_error('sport_id'); ?></span>
						</div>
					</div>

What is wrong with what it shows? Does it leave stuff out, or display in the wrong format, or what?

It leaves all the stuff out, the only part that is there is the title

OK. What is $sports here, can you show where that was built?

If you go to http://www,livefootballtips.com you can log in with demo1 for both name and password, click on name then post new tip and you will see the problem I have

Yes, but I won’t be able to see the code for how you build the list.

$sports are the different sports I can select in the backend which was built in the database

Im sorry I am quite new to this, I was hoping you may have spotted something wrong in the code or something

Well, I guessed that. Your loop seems to iterate through that variable, and as I can’t see any specific issue in the code you posted, that suggests there is an issue in the way that the $sports variable was built.

Without sounding stupid! how do I check that?

I don’t know. Further up in your code there will be something that runs a query to retrieve the list of available sports. I’m guessing you are using some kind of framework here, unfortunately I have no knowledge of such things so can’t help further.

ok well thanks for trying, cheers

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.