Heya all...
Can anyone help out...
Basically I have a form with multiple text input boxes. The number of these increases...so the next <tr> would have name2,comment2,date2,time2,id2 then the next sequence is 3...and so on.
So when the data is posted it's stored in the array $HTTP_POST_VARS. What I would need to do is somehow create a function that would foreach
nameX commentX dateX timeX do a mysql query:
UPDATE comments SET name='$username', comment='$comment',date='$date', time='$time' where id=$id".
I've managed to post the variables into POST VARS array and can view them using list/each as follows:
while (list($key, $value) = each ($HTTP_POST_VARS)) {
But I'm unsure how to extract the data to build up sql statements. I'm guessing that I'll need to loop through the array build up a sql statement per sequence. But since list and each just return ALL the values per key. I don't know how to seperate the variable per sequence sets!! I'm probably not approaching the data extraction properly.
Someone suggested another method to appending a number to each item. They suggested using an array per text input e.g.
<input type="text" name="name[]"..
This seems to create an array within $HTTP_POST_VARS. But I'm unable to access anything within that array.. I tried accessing it by $HTTP_POST_VARS[name]. But it returns nothing ???
Any pointer on how I should approach this problem. I seached every page on $HTTP_POST_VARS, arrays and text inputs. Everyone talks about submitting forms with only one set of text inputs. But I can find nothing on submitting multiple text inputs
Thanks in advance for any help..
Ta,
Tay "MadHatter" Jones