There really is no problem using 40 variables,
within a query, I run a commercial site, where you
can design and distribute a survey of up to 90
questions, I control insert database queries using a
dynamic engine I designed using for loops.
Either way though your still going to be doing the
processing of the 40 variables, which are essentially
such when you recieve them in the HTTP header.
Remember the _GET super variable is of type array
anyway.
A for loop could be used thusly;
//You must first create the record before you have dynamic access
$query = "INSERT into tblname VALUES ("","","" * 40)";
$try=mysql_db_query(DBNAME,$query);
$id = mysql_insert_id();
for ($i = 0; $i <= 40; $i++){
$answer = "answer".$i; //Form element name
$ans = $HTTP_POST_VARS[$answer];//Extract from http array
/*
I have assumed your column names are the
same as your form variables eg, answer1 etc etc.
*/
$query = "UPDATE tblname SET $ans = $ans WHERE id = $id";
$try=mysql_db_query(DBNAME,$query);
}
This however is a rather long winded way of doing things. Because we have to run 41 queries rather than just 1!!
I cannot think of how else you mean to do this,
but I suppose this would be alright if you needed
control over the variables individually.
Hope this has helped.