 <p>Try using foreach loop.</p> <pre><code>$game = $_POST['game_rate']; // with the proviso $ _ POST ['game_rate'] is an array $game_opt = $_POST['game_opt']; $index = 0; foreach($game as $g){ $query = "INSERT INTO t_game(game_rate, game_opt) VALUES('$g', '".$game_opt[$index]."')"; // Execute the query variabel $index++; } </code></pre>