Hey guys, here's what I'm trying to do:

I'm using Drupal basically as a inventory database and I have 2 content types: "Manufacturer" and "Products"

"Manufacturer" is basically a 1-field table that contains a mass list of hardware manufacturers. I have a page view so I can add/edit/delete these at any time.

The other content type is "Products", which has many fields, such as product name, description, price, etc.

Now, I want to add a drop-down field to "Products" which, when clicked, lists the entire manufacturers that I currently have on manufacturers content. So the person can just pick it from this drop-down instead of typing the manufacturer name manually on a text field.

I'd greatly appreciate if you could tell me the modules I need to install and briefly describe what I should be doing. Thanks in advance!



bwv’s picture

If you create a taxonomy vocabulary called "Products" and list all the manufacturers there, you will get the drop down menu that you need; just make sure you ascribe the product vocabulary to the Product content type.

The other way to do this is to use a combination of the CCK and Views modules. But if the taxonomy method works for you, I'd use it.

mradcliffe’s picture

I prefer using a cck node reference if I already have two content types. This would fit your current model better.

froatich’s picture

Thanks both :)

basanthkoganti’s picture

Hello guys,

I have created two content types "project" "tasks"(not using cck). and also tables in the database for "project" and "tasks".
When a user enters project name(default:title) which goes into node table and content(default:body )which also goes into node table and the remaining fields which i created goes into project table(project start date etc.,).

Now ,I need a drop down list in tasks content type which has the project field(containing the project titles). which i think should be retrieved from node table.

Probably for this i need to write a sql query to retrieve the titles from the node table where type is project.

Can you guys please let me know where should i write the sql query.(I am a new bee just started module development)

Thank you for your time and consideration


Pav’s picture

I know this post is dated but I've heard that a few people new to Drupal are having this issue. I try to outline here.

1. You need to have Option Widgets module enabled in you CCK.
2. Then in your Content Type (the one where you are going to have the drop down - in the example above tasks content type) just add new field and select text, then select-list field.
3. Create a Node View which lists whatever you want in the drop down (project titles) from the content type you want to (project content type). To do this in Views select Fields and add (+ plus sign) Note: Title. In Filters select Node Type (Project).

Test your View by clicking Preview button in views. It should return your Titles.
Now for the tricky part:
4. Go to your content type where you want your drop down (tasks content type). Configure the newly created select-list filed and scroll down to Global settings, Allowed Values and in the part where you can add PHP code add:

In the below you will need your SQL query which you can get from running "preview" in your created View.

'title' will have to be the part you Select in your SQL statement.

Template would be something like this:
$sql = "Your SQL query you can take from Views";
$res = db_query($sql);
while($row = db_fetch_array($res)){
$rows[$row['title']] = $row['title'];
return $rows;

There you go your drop down should be include the title as value and in the list.

ronnienorwood’s picture

This helped a lot.

warrenwater’s picture

Thanks all, I still have this problem, too.

Pav’s picture

Here is my attempt of explaining one way of achieving this - let me know what exactly the issue you are having is. Have you tied this: http://drupal.org/node/1016094 ?

apsara1’s picture

If it would have been a simple PHP application , i could have added a Drop Down from Markets table in Special offers form and done it easily .