![]() |
Subcategory dropdown based on main category Codeigniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Subcategory dropdown based on main category Codeigniter (/showthread.php?tid=61172) |
Subcategory dropdown based on main category Codeigniter - El Forum - 10-06-2014 [eluser]webmarkcompt[/eluser] Hello everyone How can I insert value of the category (code) instead of category id in the mysql database? This is the main category select code Code: <div class="control-group"> This is the depend subcategory select controller Code: function getSubCatLeathers_a() The subcategory is saving the name in the line $catL_a[$category->code] = $category->code; But I can't do the same at main category cause I need the ID to select subcategory. Is any way to overcome this? Tables Code: CREATE TABLE IF NOT EXISTS `subcatleathers` ( Subcategory dropdown based on main category Codeigniter - El Forum - 10-06-2014 [eluser]webmarkcompt[/eluser] Someone? Any solution? Subcategory dropdown based on main category Codeigniter - El Forum - 10-06-2014 [eluser]InsiteFX[/eluser] Code: $cat_name = "name"; Now it is global to any view part. Subcategory dropdown based on main category Codeigniter - El Forum - 10-06-2014 [eluser]webmarkcompt[/eluser] [quote author="InsiteFX" date="1412631919"] Code: $cat_name = "name"; Now it is global to any view part. [/quote] Thanks InsiteFX for reply But.. how do I implement that in this code? I've tried on the controller but don't know how to do that. Subcategory dropdown based on main category Codeigniter - El Forum - 10-06-2014 [eluser]InsiteFX[/eluser] You can added to your view Code: <?php Subcategory dropdown based on main category Codeigniter - El Forum - 10-06-2014 [eluser]webmarkcompt[/eluser] [quote author="InsiteFX" date="1412638614"]You can added to your view Code: <?php [/quote] Right... But there is the issue. In a normal query I would use the id of the record, as I think you suggested, but here the the goal is to insert the value of this register and not the id. It has to do with the fact that they want the products remain unchanged after insertion, regardless of changes that will make the codes of the article (skin, lining, outsole). By the way, this is a invoice plataform for a shoes company. So.. That's why I asked if there would be possibility to make the select, using the id to identify the subcategory, but enter the category name and not the ID... This is possible? Please take a look at the attachment. |