title: how to input data array looping to database
body: <p>i have a code like this, i dont know what wrong with my code</p>
  
  <pre><code>$peringkat=0;
  //pencarian ranking terbesar ke terkecil berdasarkan value
  $ranking = array("$ATTT[0]" =&gt; "$HA[0]", "$ATTT[1]" =&gt; "$HA[1]");
  arsort($ranking);
  foreach ($ranking as $alternatif =&gt; $nilaialternatif) {
  $peringkat++;
  echo "
  &lt;th class='akhir'&gt;&lt;input class='rankingakhir' type='text' name='alternatif' 
  value='$alternatif' size='12' readonly&gt;&lt;/th&gt;
  &lt;td class='akhir'&gt;&lt;input class='nilaiakhir' type='text' 
  name='nilaialternatif' value=".number_format($nilaialternatif, 3, '.', ',')." size='12' readonly&gt;&lt;/td&gt;
  &lt;td class='akhir'&gt;&lt;input class='rankakhir' type='text' 
  name='rankingalternatif' value='$peringkat' size='12' readonly&gt;&lt;/td&gt;&lt;/tr&gt;";
  }   
  echo '&lt;/table&gt;&lt;div class="akhir"&gt;&lt;input class="akhir" type="submit" 
  value="Simpan Ranking ke Database"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
  </code></pre>
  
  <p>i run var dump but just record data from alternatif 2</p>
  
  <pre><code>array(3) { ["alternatif"]=&gt; string(12) "Alternatif 2" ["nilaialternatif"]=&gt; string(5) "0.223" ["rankingalternatif"]=&gt; string(1) "2" }
  </code></pre>
  
  <p>table in live design
  <img src="https://i.stack.imgur.com/IMaUL.jpg" alt="enter image description here"></p>
  
  <p>my database code</p>
  
  <pre><code>$Host = "localhost";         //Memilih host, Localhost berarti komputer itu sendiri
  $User = "root";             //Memilih user/pengguna
  $Password = "";             //Password, Biasanya Kosong
  $db       = "spkjazuly";         //Memilih Database
  $konek=mysql_connect($Host,$User,$Password)or die (mysql_error()); 
  mysql_select_db ($db,$konek) or die (mysql_error("TIdak Terhubung Ke Server 
  Mysql")); //Menghubungkan ke Mysql dan memilih Database
  mysql_query("replace INTO ranking VALUE(DEFAULT,'$_GET[B11]','$_GET[alternatif]','$_GET[nilaialternatif]','$_GET[rankingalternatif]')") //Perintah Mysql untuk mengisi tabel Tamu
  or die(mysql_error("Tidak Berhasil Menyimpan !"));  //Or Die (mysql_error()) Pesan Error
  echo "&lt;h1&gt;Berhasil Menyimpan Data&lt;/h1&gt;"; 
  </code></pre>
  
  <p>sory for my english, i try my best.</p>