Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Dynamic List/Menu with 2 columns

Community Beginner ,
Mar 30, 2013 Mar 30, 2013

Copy link to clipboard

Copied

I have created a Dynamic List/Menu box based on a recordset and showing me one field of that recordset ['Firmanaam'].

<?php

do { 

?>

            <option value="<?php echo $row_klantenselectie['Firmanaam']?>"><?php echo $row_klantenselectie['Firmanaam']?></option>

            <?php

} while ($row_klantenselectie = mysql_fetch_assoc($klantenselectie));

  $rows = mysql_num_rows($klantenselectie);

  if($rows > 0) {

      mysql_data_seek($klantenselectie, 0);

   $row_klantenselectie = mysql_fetch_assoc($klantenselectie);

  }

?>

First question what is the difference between 'values" and 'labels' in the creation box of the Dynamic List/menu as only the field entered in the 'labels" is shown in the listbox ?

Secondly I want to display two columns in the List box (one column with the client ID and one column with the clients name). How do I proceed ? Afterwards clicking on the selected client should send the client ID to another field in the form.

Thank you for your replies.

TOPICS
Server side applications

Views

716
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 30, 2013 Mar 30, 2013

Copy link to clipboard

Copied

LATEST

Moved to the Develop server-side applications in Dreamweaver forum, which deals with this sort of issue.

First question:

The Values field in the Dynamic List/menu dialog box populates the value attribute in the opening <option> tag. Because it's an HTML attribute, it's not displayed when the page is rendered in a browser. The Labels field puts the text that will be displayed in the drop-down menu between the opening and closing <option> tags.

Put the value you want displayed in the Labels field, and the value you want sent to the server when the form is submitted in the Values field.

Second question:

Normally, you would put the ID in the Values field, and the name in the Labels field.

Because the value attribute will contain the ID, it shouldn't normally be necessary to populate another field with the selected value because the ID will be sent to the server with the rest of the form data when the form is submitted.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines