Ok I want to make things easy for my users to add key words to their database. So I have a form with 14 text boxes, one word per box. Now I want it so that they dont have to fill all boxes. I also dont want to shove empty elements into the array so I have come up with this for loop that just is giving me problems.
My text boxes spit out to the variables $kw1, $kw2 $kw3 and so on up to 14, the last var would be $kw14.
I did the following loop:
<?php
$keywords = array();
for ($i = 1; $i < 15; $i++) {
if ($kw$i > "") {
array_push ($keywords, $kw$i);
}
?>
this is the error I get: Parse error: parse error, unexpected T_VARIABLE
I believe it has something to do with the $kw$i should it be something like $kw{$i} ?? I know if it were all part of a string then $kw[$i] would work fine, however this is looping through variables and if the variables have data then they are sent to the array, any help?? Any idea?? -- TX