473,395 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Create x amount of checkboxes based on data in table

Hi,

Firstly, i have 2 tables that i need to populate. 'recipe' and 'recipeequipment'. I need to get a list of equipment from the 'equipment' table and their ids and display this to the user so they can choose what equipment they like(possibly more than 1).

My question is how do i create x amount of checkboxes with the equipment from the table. alongside this i will need a textbox so that the user can input how many of each equipment they want.

This will ofcourse need to be put into the database so will need unique ids in the form so i can get the values required.

Does anyone have any suggestions of how to accomplish this?

Thanks.
Nov 24 '11 #1
2 1851
Rabbit
12,516 Expert Mod 8TB
I assume you'll do it in a loop and use the unique id as part of the form control's name.
Nov 25 '11 #2
1) make sure your recipeequipment table has an auto increment primary key. By this you are having a unique key / id for every record automaticly.

2) SELECT all records from recipeequipment` where the recipe id is the one you need into one array.

3) use sizeof($arrayname) or count($arrayname) on the resultset to get the amount.

This way you have all the data you need alongside with the number of records and their respective unique ids (inside every record in the array)

Step 3 could be left off if you want to display the recipeequipment line by line .. you would just use some foreach() loop iterating over the array you got in 2)

2)
Nov 26 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: rcamarda | last post by:
Hi, I wish to create new rows of data based on a source table. Example: I have a file that contains a SESSION (time roughly a calendar quarter for a University), START_DT, END_DT. I want to...
0
by: Chris Powell | last post by:
I am using Excel/Access 2000 and have two large Excel files (25,000 rows each) that I wish to create linked tables in Access rather than importing into Access. The two source Excel files change...
2
by: A P | last post by:
Hi! I am using Web Matrix in learning ASP.Net and I am only using MS Access as my database. What namespace and Connection that I may use to handle this? As stated on the ASP.Net...
8
by: Woody Splawn | last post by:
Lets say I have a winform that is populated with a dataset. The dataset and data table may have several rows in it. Lets say I am looking at the winform and I want to assign a value to a certain...
0
by: neoteny2 | last post by:
I need MS Access to automatically create reports/subreports based on specific criteria. I am building a database in Access 2003 with different locations/sites. I have the "sites" table created...
2
by: Geovanni Cesar | last post by:
I have a table with 12 checkboxes. I have the following function which when I check the last checkbox in the table, the first 10 checkboxes in the table are unchecked. - function...
2
by: hermanh28 | last post by:
tearing my hair out over this! I have 2 tables: PTable which lists all traits pid,ptype 1,good 2,bad 3,neutral
15
by: jt196 | last post by:
I'm trying to create an editable form of fulfilled orders on my system and am running into problems with creating a form based on this query. The field that I need to update (invoice number) is...
3
SPanicker
by: SPanicker | last post by:
How can I design an efficient AJAX based dynamic table using .NET ? Do I necessarily need to use JQuery / Prototype libraries or plug-ins to achieve this? I am referring to similar implementation...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.