Before asking, here's my form picture:

As you can see, I have 1 form with 2 tables, in each table, there are six inputs.
The input code in "Table Alat" and "Table Bahan" is like this:
<form method='post' action='p_input.php'>
<table>
<tr>
<td>1.</td>
<td><input type='text' name='nama[]' style='width:100%;' autocomplete='off'></td>
<td><input type='text' name='merk[]' style='width:100%;' autocomplete='off'></td>
<td><input type='text' name='kemasan[]' style='width:100%;' autocomplete='off'></td>
<td><input type='text' name='mhs[]' style='width:100%;' autocomplete='off'></td>
<td><input type='text' name='jml[]' style='width:100%;' autocomplete='off'></td>
<td><input type='text' name='hps[]' style='width:100%;' autocomplete='off'>
<input type='hidden' name='jenis[]' value='alat' autocomplete='off'></td>
</tr>
</table>
<table>
<tr>
<td>1.</td>
<td><input type='text' name='nama[]' style='width:100%;' autocomplete='off'></td>
<td><input type='text' name='merk[]' style='width:100%;' autocomplete='off'></td>
<td><input type='text' name='kemasan[]' style='width:100%;' autocomplete='off'></td>
<td><input type='text' name='mhs[]' style='width:100%;' autocomplete='off'></td>
<td><input type='text' name='jml[]' style='width:100%;' autocomplete='off'></td>
<td><input type='text' name='hps[]' style='width:100%;' autocomplete='off'>
<input type='hidden' name='jenis[]' value='bahan' autocomplete='off'></td>
</tr>
<table width='100%' align='center' style='margin-top:0;'>
<tr>
<td><input name='reset' type='reset' id='bersihkan' value='Reset'>
<input name='submit' type='submit' id='ajukan' value='Send'></td>
</tr>
</table>
</table>
</form>
The difference in here is <input type='hidden' name='jenis[]' value='alat' autocomplete='off'>, for "Table Alat" the value is 'alat' for "Table Bahan" the value is 'bahan'(I have no trouble in here, just telling you).
This is my p_input.php script:
<?php
error_reporting(0);
session_start();
if(isset($_REQUEST['submit'])) {
include "../conf/koneksi.php";
$count = count($_POST['nama']);
$jurusan = $_POST['jurusan'];
$lab = $_POST['lab'];
$materi = $_POST['materi'];
$mahasiswa= $_POST['mahasiswa'];
for($i = 0; $i < $count; $i++){
$nama = mysql_real_escape_string($_POST['nama'][$i]);
$merk = mysql_real_escape_string($_POST['merk'][$i]);
$kemasan = mysql_real_escape_string($_POST['kemasan'][$i]);
$mhs = mysql_real_escape_string($_POST['mhs'][$i]);
$jml = mysql_real_escape_string($_POST['jml'][$i]);
$hps = mysql_real_escape_string($_POST['hps'][$i]);
$jenis = mysql_real_escape_string($_POST['jenis'][$i]);
$sql2= "ALTER TABLE tb_usulan AUTO_INCREMENT = 1";
mysql_query($sql2);
$sql=mysql_query("INSERT INTO tb_usulan (nama,merk,kemasan,kebutuhan,jml_kebutuhan,hps,jenis,materi_praktikum)
VALUES
('$nama', '$merk', '$kemasan', '$mhs', '$jml', '$hps','$jenis','$materi')") or die(mysql_error());
}
}
?>
And my question is: If I only fill input in "TABLE ALAT" and keep input in "TABLE BAHAN" empty, then when I click submit, I want only input in table alat to insert/post to database, and vice versa, if I only fill input in "TABLE BAHAN" and keep input in "TABLE ALAT" empty, then only input in "TABLE BAHAN" will insert/post to database.
UPDATE QUESTION: This is only one form and one submit button, and insert it to the same table at same time.
if(!empty($_POST['nama'][$i]))to check whether that form is filled in.empty()function.