Welcome Guest, Not a member yet? Register   Sign In
Form field data pulled from database
#18

[eluser]jedd[/eluser]
Quote:The foreach loop is to loop through the results and have them ready to be placed in the drop down;

I don't know what you think 'have them ready' means.

The foreach loop you have shown does nothing - no variables are assigned, no data are changed. You are saying 'for each data in here, this data is here'. The code is moot, but nonetheless unsettling.

Fuzzy's code is option 2 from the list of three options I suggested we explore. If you're happy with that .. then it could be time to post the current state of your code again. Before you do, however, you may want to experiment some more with var_dump (or print_r) calls, to enquire on the nature of the variable you're passing into your view, just before you feed it into your drop_down function. The <pre> stuff I mentioned before was purely as an aid for readability - the print_r and var_dump output tends to be easier if you go into PREFORMATTED mode first, that's all.



Quote:
Code:
1 --- Displayed as an optgroup
2
Company 2
Basically, I only want only the name of the company to appear in the list (there will potentially be about 50 companies in this list) and when inputting the project into the database, the id of the selected company will get inserted into the project row.

Gotcha. Show us the bit in your controller where you call get_customers(), and the bit where you transfer that data to your view, and the bit in your view where you're trying to display this with form_dropdown().


Messages In This Thread
Form field data pulled from database - by El Forum - 03-16-2009, 06:54 PM
Form field data pulled from database - by El Forum - 03-16-2009, 07:09 PM
Form field data pulled from database - by El Forum - 03-16-2009, 07:28 PM
Form field data pulled from database - by El Forum - 03-16-2009, 07:49 PM
Form field data pulled from database - by El Forum - 03-16-2009, 07:55 PM
Form field data pulled from database - by El Forum - 03-16-2009, 07:56 PM
Form field data pulled from database - by El Forum - 03-16-2009, 08:04 PM
Form field data pulled from database - by El Forum - 03-16-2009, 08:12 PM
Form field data pulled from database - by El Forum - 03-16-2009, 08:24 PM
Form field data pulled from database - by El Forum - 03-16-2009, 09:23 PM
Form field data pulled from database - by El Forum - 03-16-2009, 09:58 PM
Form field data pulled from database - by El Forum - 03-16-2009, 11:17 PM
Form field data pulled from database - by El Forum - 03-17-2009, 03:14 AM
Form field data pulled from database - by El Forum - 03-17-2009, 03:30 PM
Form field data pulled from database - by El Forum - 03-18-2009, 06:17 AM
Form field data pulled from database - by El Forum - 03-18-2009, 07:58 AM
Form field data pulled from database - by El Forum - 03-18-2009, 04:17 PM
Form field data pulled from database - by El Forum - 03-18-2009, 05:38 PM
Form field data pulled from database - by El Forum - 03-18-2009, 06:51 PM
Form field data pulled from database - by El Forum - 03-18-2009, 07:10 PM
Form field data pulled from database - by El Forum - 03-18-2009, 07:22 PM
Form field data pulled from database - by El Forum - 03-18-2009, 07:44 PM
Form field data pulled from database - by El Forum - 03-18-2009, 09:00 PM
Form field data pulled from database - by El Forum - 03-18-2009, 09:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB