spare Posted August 27, 2006 Share Posted August 27, 2006 Hello,I have a registration form with option menus. Once a member, the visitor can alter their information. In order to prevent them from altering some fields, I have stopped the options menus from updating the db but they still appear as option menus. I would like the option to just appear as fixed text on the page. I did this without any problem with the information stored on the db as text but I am having problems with the information stored as numbers. The options are saved on the db as id numbers which correspond to the options' names (i.e. id# 14 is the id for "Green"). it seems the only way I can have the selected option correctly reappear is in an options menu. When I try I can only get the first or last option never the option the member chose.I'd appreciate any suggestions.The HTML part[code]<tr> <td align="right" valign="top"><strong>{TXT_COLOURS}</strong></td> <td> <select name="colours" id="colours" class="textbox"> <!-- BEGIN: colours_opts --> <option value="{VAL_COLOURS_ID}" {COLOURS_SELECTED}>{VAL_COLOURS_NAME}</option> <!-- END: colours_opts --> </select> </td>[/code]A view of the db layout+-----------------------------------------+| ID | ABV | NAME | +-----------------------------------------+| 1 | blu | Blue |+-----------------------------------------+| 2 | red | Red |+-----------------------------------------+| 3 | yel | Yellow |+-----------------------------------------+The PHP part[code]$profile->assign("TXT_COLOURS",$profile['colours']); $colours = $db->select("SELECT id, abv, name FROM ".$glob['dbprefix']."Acada_iso_colours ORDER BY name"); for($i=0; $i<count($colours); $i++){ if($colours[$i]['id'] == $acaUserData[0]['colours']){ $profile->assign("COLOURS_SELECTED","selected='selected'"); } else { $profile->assign("COLOURS_SELECTED",""); } $profile->assign("VAL_COLOURS_ID",$colours[$i]['id']); $coloursName = ""; $coloursName = $colours[$i]['name']; if(strlen($coloursName)>40){ $coloursName = substr($coloursName,0,40)."…"; } $profile->assign("VAL_COLOURS_NAME",$coloursName); $profile->parse("profile.session_true.colours_opts"); } $profile->assign("VAL_COLOURS",$acaUserData[0]['colours']);[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.