Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 01-13-2005, 09:40 AM   #1
Member (9 bit)
 
Join Date: Jan 2001
Location: Kalamazoo, MI
Posts: 314
Send a message via ICQ to sdkramer Send a message via AIM to sdkramer Send a message via Yahoo to sdkramer
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
sdkramer is offline   Reply With Quote
Old 01-13-2005, 10:26 AM   #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.)
__________________
WhatsThisBoxFor? is offline   Reply With Quote
Old 01-13-2005, 12:07 PM   #3
Member (8 bit)
 
9600baud's Avatar
 
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...
9600baud is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:15 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2