You are here: POST arrays - each as SQL statement « PHP Programming Language « IT news, forums, messages
POST arrays - each as SQL statement

Posted by Karl Groves on 06/12/06 18:55

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация