Solved

Dynamic pop up menus

Posted on 1998-07-13
4
166 Views
Last Modified: 2013-11-28
I want to display a popup menu on my form. The options of this popup ought to come from a DB table.

e.g there could be a table having employee codes and employee names. I would like to display all the names in the DB table as a popup menu on a form for the user to be able to select any one.

Effectively which would mean that if any record is deleted from the DB we don't see that entry as an option on the popup menu.

Could somebody give me a way to do this.
0
Comment
Question by:sanjaychopra
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
b2pi earned 100 total points
ID: 1208401
Since you don't say what database you're using, or how you're getting the list of data from the database, it's a little difficult to be explicit, but you're looking for something along the lines of:


print "<SELECT NAME=\"Menu_Variable\">\n";
my(@datalist) = <source your data here>
foreach (@datalist) {
   print "<OPTION VALUE=\"$_\"> $_\n";
}
print "</Select>\n";



By the way, this isn't reallly a perl question, but rather an HTML question...
0
 

Author Comment

by:sanjaychopra
ID: 1208402
Thanks for your reply.

I think I need to elaborate upon the problem a bit more to get a more accurate answer from you.

I am using an Oracle Database.
I have a table with the following structure :

 Name                            Null?    Type
 ------------------------------- -------- ----
 ID                              NOT NULL CHAR(3)
 NAME                            NOT NULL VARCHAR2(30)
 AGE                                      NUMBER(38)
 SEX                                      CHAR(1)

Let us assume we have five records in this table.
Now I would like to have a pop up menu or a radio buttons
group listing all the ids that are there in the table.

I was approaching the problem by building an array which would have all the id's that there in the the table at the point of time and then trying to use this array with the the default method of showing popup menus in PERL.


      #print "<P><EM>Select an ID</EM><BR>";
        #$query->popup_menu(
        #                -name=>'id',
        #                -values=> [the name of the array that i am building]
        #                ),"<P>";
 
But somehow i am not able to do that.
Coule you help ne solving the problem by this approach.
0
 

Author Comment

by:sanjaychopra
ID: 1208403
Thanks for your reply.

I think I need to elaborate upon the problem a bit more to get a more accurate answer from you.

I am using an Oracle Database.
I have a table with the following structure :

 Name                            Null?    Type
 ------------------------------- -------- ----
 ID                              NOT NULL CHAR(3)
 NAME                            NOT NULL VARCHAR2(30)
 AGE                                      NUMBER(38)
 SEX                                      CHAR(1)

Let us assume we have five records in this table.
Now I would like to have a pop up menu or a radio buttons
group listing all the ids that are there in the table.

I was approaching the problem by building an array which would have all the id's that there in the the table at the point of time and then trying to use this array with the the default method of showing popup menus in PERL.


      #print "<P><EM>Select an ID</EM><BR>";
        #$query->popup_menu(
        #                -name=>'id',
        #                -values=> [the name of the array that i am building]
        #                ),"<P>";
 
But somehow i am not able to do that.
Coule you help ne solving the problem by this approach.
0
 
LVL 5

Expert Comment

by:b2pi
ID: 1208404
I'm sorry, I just saw that this message was here.

Ummm, two steps:

1.) Assuming that the array of values loaded from the database is called @tArr, try using

   -values => [@tArr],

Yes, Actually put the square braces in there.

2.) If that doesn't help, send more code... (i.e. the select code and the popup_menu code.  Also, tell me what happens when it runs.

Hopefully, step 1 will work.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Digital marketing agencies have encountered both the opportunities and difficulties that emerge from working with a wide-ranging organizations.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now