Changing an option from a drop down menu

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
larissahn
Forum Newbie
Posts: 3
Joined: Wed Apr 08, 2009 9:42 pm

Changing an option from a drop down menu

Post by larissahn »

hi, this question might just be the stupidest ever, but I want to be careful and not mess anything up. this is the code for a drop down menu I have in an application page.
<select name="ProgrammeName" id="ProgrammeName">
<option value="" selected="selected" disabled="disabled">Select Programme</option>
<option value="2-Week" <?php if (!(strcmp("2-Week", KT_escapeAttribute($row_rstblapplication['ProgrammeName'])))) {echo "SELECTED";} ?>>2-Week</option>
<option value="4-Week" <?php if (!(strcmp("4-Week", KT_escapeAttribute($row_rstblapplication['ProgrammeName'])))) {echo "SELECTED";} ?>>4-Week</option>
<option value="8-Week" <?php if (!(strcmp("8-Week", KT_escapeAttribute($row_rstblapplication['ProgrammeName'])))) {echo "SELECTED";} ?>>8-Week</option>
</select>


to change from a 2 week to a 3 week option, I just substitute the 3 for a 2, right? I think it is just a string, I'm just not sure what >2-Week</option> at the end of the line is, not calling a variable, right?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Changing an option from a drop down menu

Post by califdon »

Whatever appears between the <option ......> and the </option> tags is what will be shown in the dropdown. It is not necessarily the same as the value for the select group when it is selected, that is what is in the value= parameter within the <option .....> tag.
Post Reply