title: multiple save from result php
body: <p><strong>this form will store the same data in the amount of the result</strong></p>
  
  <pre><code> &lt;form method="post" action="multi_insert.php"&gt;
  
    &lt;input type="text" name="nis" placeholder="NIS"/&gt;
    &lt;input type="text" name="nama" placeholder="Nama"/&gt;
      &lt;input type="number" name="result" &gt;
  
    &lt;br/&gt;
  
    &lt;input type="submit" value="Post"/&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>"and this is source code for save named <code>multi_insert.php</code>"</p>
  
  <pre><code>include "koneksi.php";
  
  for($i=0;$i&lt;$_POST['result'];$i++){
   $nis = $_POST['nis'.$i];
   $nama= $_POST['nama'.$i];
   $query = "insert into SISWA(NIS,NAMA)values('$nis','$nama')";
   $mysqli-&gt;query($query);
  }
  $mysqli-&gt;close();
  </code></pre>
  
  <p>and this connectiondb or koneksi.php</p>
  
  <pre><code>$host = "localhost";
  $username = "root";
  $password = "";
  $db_name = "SEKOLAH";
  $mysqli = new mysqli($host, $username, $password, $db_name);
  if(mysqli_connect_errno()) {
  echo "Error: Could not connect to database.";
  exit;
  </code></pre>