POST arrays - each as SQL statement



I have a rather long form (122 SETS of questions - don't worry, it is
just me using it, lol)

I have the questions set up as "Survey ID, Question ID, Answer, Impact,
Comments", which I have set up so that each question is an array, like
so:
ques_1['survey_id']
ques_1['question_id']
ques_1['answer']
ques_1['impact']
ques_1['comments']

I want to dynamically create SQL statements for each of these arrays,
looping through the POST array, creating & running each of these
dynamically created SQL statements.

Unfortunately, when I attempt to access each array, I can't get the
values of each key.

For instance, consider the following:

foreach ( $HTTP_POST_VARS as $key => $value ) {
// I know for a fact, $value will be an array
print("<pre>");
var_dump ($value);
print("</pre>");
}

Results in:

array(5) {
["\'question_id\'"]=>
string(1) "1"
["\'survey_id\'"]=>
string(1) "2"
["\'answer\'"]=>
string(3) "N/A"
["\'impact\'"]=>
string(1) "0"
["\'comments\'"]=>
string(12) "sdfsdfsdfsdf"
}


So, now I know that $value has 5 keys:
question_id
survey_id
answer
impact
comments


So, why can't I access $value['question_id']; (or any of the other
values of the other keys)?




--
Karl Groves
www.karlcore.com
.



Relevant Pages

  • Re: comparing some but not all fields in lists
    ... and what's in common." ... I should compare only 3 of the 82 fields in each list. ... comparing all 82 fields as a single array element. ... cannot handle multiple keys as you want it to. ...
    (perl.beginners)
  • Re: Build an array from a text file
    ... Now that I have created my array, ... The dictionary object has a 'keys' method that returns a 0 based array ... Dim vArray As Variant ... dictionaries, so any help would be great! ...
    (microsoft.public.word.vba.general)
  • Re: Hash table with coarse integer keys
    ... The edges' ids are ordered from 0 to the ... One optimization I came up with was just using a dense array of the ... dictionary with 10 millions of keys randomly chosen between 0 and 20 ... What is the hashing algorithm used by C# Dictionary? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: "map" a deeply nested structure: Object#deep_map
    ... if the key is an Array or Hash? ... I was not interested in mapping keys, but this would be a reasonable ...   when String ...
    (comp.lang.ruby)
  • Hash table with coarse integer keys
    ... The edges' ids are ordered from 0 to the ... One optimization I came up with was just using a dense array of the ... dictionary with 10 millions of keys randomly chosen between 0 and 20 ... What is the hashing algorithm used by C# Dictionary? ...
    (microsoft.public.dotnet.languages.csharp)