select Lookup onchange event data in another field

Hi all i need some help with selecting and lookup.

I have 5 select fields, the first one needs to select the first level of a category then subcategories after, I have created fields call catl1,catl2,catl3,catl4,catl3. the category table (category) has id_category, id_parent and level_depth the table (category_lang) has the id_category and the ‘name’

I only want to display the name in the select dropdown not the id_category.

I have created this mysql in lookup and it works fine in the first dropdown.

SELECT
category_lang.name,category.id_category
FROM
category,category_lang
WHERE
category.level_depth = 2 and category.id_parent = 2 and category_lang.id_category = category.id_category
GROUP BY
name

My question is, the next category level is 3 and I need to show only names from category next level, in this case would be level_depth 3.

can anyone help?

Regards

Dont understand the problem. Change your condition in next field, for level depth 3

I have tried that, it works if I remove category_lang.nameand only select id_category, but I need to show ‘name’ not id_category. Any Ideas?

Because first field is used on selects to use it as “ID” and second the field showed . You have to do the select as

SELECT
category.id_category, category_lang.`name`

Thanks you so much, its working.

Closed as solved.