|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (9 bit)
|
Dynamic form information
I have a form that's being built based upon a database query.
for example query results: ID=12 Complete='Y' ID=13 Complete='N' ID=14 Complete='Y' ID=16 Complete='N' ID=34 Complete='N' ID=29 Complete='N' If the item is not complete I'm creating a form item to allow the user to enter a value for it. So in this example I would have forms item named 13, 16, 34, and 29. I need a generic page to detect what input fields were submitted and insert them to the database. I guess what I'm asking is "Is there a way to get perhaps an array of all form variables submitted?" Thanks, Seth |
|
|
|
|
|
#2 |
|
PCMech: Saving Lives
Join Date: Apr 2004
Location: England, the United Kingdom
Posts: 1,839
|
What language are you using? PHP? ASP?
I only know ASP (3, not .NET) and so may not be of much help. I do not know a way to get an array of all values, but you can just request each form field indivually and 'feed' them directly to the database (although you might want to perform validation on them first.) |
|
|
|
|
|
#3 |
|
Member (8 bit)
Join Date: Aug 2002
Posts: 246
|
If you're using PHP its pretty simple. You're going to generate INPUT boxes all the same name but as an array. for example one INPUT NAME='randomname[####]'. where #### is the number of the ID you got.
When you submit the form try using it as POST and pull it as an array. In this case you'd pull it as $thearray=$_POST["randomname"]; then go through $thearray looking for valid array indexes and generate the appropiate INSERT code. hope that helps... |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|