SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old June 10th, 2004, 11:14 PM
thecomputerguy0 thecomputerguy0 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 thecomputerguy0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Assign a variable to an infinite number of items of a form to a processing page.

I select a dynamic number of CATEGORIES to a page.
while (ocifetch($curser)){
echo "<INPUT TYPE=text name ="$category_value">
}

Ok here is the thing, I do not know the number of CATEGORIES there are. So how do I assign a variable to each value from the form.

foreach value in page A, get that variable on page B.

I know that if I new the exact CATEGORY's I could select them out of the DB using the unique name of the CATEGORY as the form name. On pageB I would say $category1 = $_POST['category_name'];
$category2 = $_POST['category_name'];
so on.......

I do not know the number of the categories that will be displayed on page A, untill it is pulled from the DB. So how will I know the number od varible to use on page B, and how do I assign the values of $_POST[] to them?
Each CATEGORY may of may not have a weight assigned to it.

Any ideas will be GREATLY accepted!

Reply With Quote
  #2  
Old June 11th, 2004, 06:58 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
The way I've often handled this in the past is to assign a prefix to a given group of fields. So all fields that represent fields might be named "cat_<something>" where <something> is the database result. Then you can iterate over your $_POST vars and look for fields whose name begins with "cat_" to determine which ones are categories. No need to assign additional variables on page B -- just use the $_POST array.
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #3  
Old June 11th, 2004, 07:30 PM
thecomputerguy0 thecomputerguy0 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 thecomputerguy0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
That worked perfect. I just did a while(list(($key, As $value) each($_POST)));

The syntax may not be right here in this example but that is the concept I used to get the Form name and Value.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Assign a variable to an infinite number of items of a form to a processing page.


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway