Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $mysqli = new mysqli('localhost', 'root', '', 'mydatabase');
- $n = 0;
- foreach($_POST['nama'] as $i=>$nama){
- // parse data
- $nama = $mysqli->escape_string($nama);
- $job = $mysqli->escape_string($_POST['job'][$i]);
- $kota = $mysqli->escape_string($_POST['kota'][$i]);
- $phone = $mysqli->escape_string($_POST['phone'][$i]);
- // proses simpan
- $save = $mysqli->query("INSERT into tbldata(nama,job,kota,phone) VALUES('$nama','$job','$kota','$phone')");
- if($save)
- $n = $n+1;
- }
- if($n>0){
- echo "Data berhasil disimpan...";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement