Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //FORM
- <?php
- $opts='';
- $querys = mysql_query("SELECT id_peg,nama_peg
- FROM tb_pegawai
- WHERE jabatan_peg='Guru'
- ORDER BY nama_peg");
- while ($rows = mysql_fetch_array($querys)){
- $opts.="<option value='$rows[id_peg]'>".$rows['nama_peg']."</option>\n";
- }
- $query = mysql_query("SELECT id_mapel,nama_mapel
- FROM tb_mapel ");
- while ($row1 = mysql_fetch_array($query))
- {
- ?>
- <tr>
- <td>
- <input type="checkbox"
- name="id_mapel[]"
- class="id_mapel"
- value="<?php echo $row1['id_mapel']; ?>" />
- <?php echo $row1['nama_mapel']; ?>
- </td>
- <td>
- <select class="span7"
- name="guru[<?php echo $row1['id_mapel']; ?>]">
- <?php echo $opts;?>
- </select>
- </td>
- </tr>
- <input type="hidden" name="kelas" value="<?php echo $kelas;?>" />
- <?php
- }
- ?>
- //PROSES
- <?php
- $kelas= mysql_real_escape_string($_POST['kelas']);
- $thn = date('Y');
- $thn2 = $thn+1;
- while(list($key1, $value1) = each($_POST['id_mapel']))
- {
- $kode_seksi = buatkode("tb_seksi", "SK");
- $value2=$_POST['guru'][$value1];
- $sql = "INSERT INTO tb_seksi VALUES
- ('$kode_seksi', '$value1', '$value2','$kelas','$thn-$thn2')";
- $res = mysql_query($sql) or die(mysql_error()."<br>".$sql);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement