Jump to content


Photo

Option Menu Selection As Plain Text


  • Please log in to reply
No replies to this topic

#1 spare

spare
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 27 August 2006 - 08:48 PM

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
<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>

A view of the db layout

+-----------------------------------------+
| ID | ABV |            NAME                        |
+-----------------------------------------+
|  1 | blu |            Blue                            |
+-----------------------------------------+
|  2 | red |            Red                            |
+-----------------------------------------+
|  3 | yel |          Yellow                          |
+-----------------------------------------+

The PHP part

$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)."&hellip;";
		
				}
		
				$profile->assign("VAL_COLOURS_NAME",$coloursName);
				
				$profile->parse("profile.session_true.colours_opts");
			
			} 
	

$profile->assign("VAL_COLOURS",$acaUserData[0]['colours']);







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users