Hello,

I have the following code in my script:

Code:
answer 1 <INPUT TYPE="text" NAME="answer[]" VALUE="" SIZE="30" MAXLENGTH="100">
answer 2 <INPUT TYPE="text" NAME="answer[]" VALUE="" SIZE="30" MAXLENGTH="100">
answer 3 <INPUT TYPE="text" NAME="answer[]" VALUE="" SIZE="30" MAXLENGTH="100">
answer 4 <INPUT TYPE="text" NAME="answer[]" VALUE="" SIZE="30" MAXLENGTH="100">
answer 5 <INPUT TYPE="text" NAME="answer[]" VALUE="" SIZE="30" MAXLENGTH="100">
......
As you can see, I'm trying to get all the aswers into an array. But, when someone leave a field unanswered, then the array will contain a "". I'm trying to filter out all of the "", and strip all slaches as well.

I'm using the following code to do this:

Code:
foreach($answer as $key => $val)
   { 
   if ($val == '') {array_pop($answer);} 
   else {$val = stripslashes($val);}
   }
But this code does not work! Any one know why?