Forum Moderators: coopster

Message Too Old, No Replies

help with dynamic form select

         

ahmed24

11:20 am on Jul 13, 2009 (gmt 0)

10+ Year Member



hi everyone,

I have a code that is pasted below, the code basically dynamically creates a list of option values for a form select function.

$period_select = "<SELECT name='period'>";
foreach($RET as $period)
{
$period_select .= "<OPTION value=$period[COURSE_PERIOD_ID]".((UserCoursePeriod()==$period['COURSE_PERIOD_ID'])?' SELECTED':'').">".$period['COURSE_TITLE']."</OPTION>";
if(UserCoursePeriod()==$period['COURSE_PERIOD_ID'])
{
$_SESSION['UserPeriod'] = $period['PERIOD_ID'];
}
}
$period_select .= "</SELECT>";

What I want to do is determine if any of the option line has the $period['COURSE_TITLE'] as blank and if so I dont want that entire option line to be echo'ed in the result.

can anyone please tell me how I can achive this?

many thanks

ahmed24

12:52 pm on Jul 13, 2009 (gmt 0)

10+ Year Member



nevermind, i have done it. simply just added in the html comment out tags (<!-- -->) if the value is blank