Process form with dynamicly generated field names
Posted: Sun Jun 05, 2011 2:37 pm
[Extreme newbie alert!]
I am trying to process a form that uses dynamically generated field names.
This is for my own use so it doesn't need to be pretty, just accurate
I currently using a spreadsheet to track a list of available items, which ones are in use and how many are in use on a particular day.
Not that it should matter but it is running: Linux, MySQL, PHP5, Apache2
items table
itemID int
itemName varchar
itemInUse tinyInt (boolean)
PRIMARY KEY(itemID)
inventory table
date_stamp
itemID
itemCount
PRIMARY KEY(date_stamp, itemID)
query to gather data for table
select itemID,itemName from items where itemInUse = True
what I am using to create the table
Then above is working fine, it the processing part that is confusing me. I have unique text field names like item-1, item-6, item-54. The item-xx will not be in any particular order nor will every item have a value. item-1 may have the value of 22 and item-2 may be null or zero.
I can't find any documentation for stepping through the POST data for unknown 'names'.
I wish I could describe this better.
Thanks,
Ed
I am trying to process a form that uses dynamically generated field names.
This is for my own use so it doesn't need to be pretty, just accurate
Not that it should matter but it is running: Linux, MySQL, PHP5, Apache2
items table
itemID int
itemName varchar
itemInUse tinyInt (boolean)
PRIMARY KEY(itemID)
inventory table
date_stamp
itemID
itemCount
PRIMARY KEY(date_stamp, itemID)
query to gather data for table
select itemID,itemName from items where itemInUse = True
what I am using to create the table
Code: Select all
print("<table border='1'>\n");
print("<tr><td>Item ID</td><td>Item Name</td><td>Count</td></tr>\n");
while($row = mysql_fetch_row($result)){
print("<tr><td>".$row[0]."</td><td>".$row[1]."</td><td><input type='text' name='item-".$row[0]."'</td></tr>\n");
}
...
I can't find any documentation for stepping through the POST data for unknown 'names'.
I wish I could describe this better.
Thanks,
Ed