Jump to content

Option Menu Selection As Plain Text


spare

Recommended Posts

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)."&hellip;";

}

$profile->assign("VAL_COLOURS_NAME",$coloursName);

$profile->parse("profile.session_true.colours_opts");

}


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


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.