Siang Mas Ellyx, saya ada pertanyaan ni mas? Bagaimana ya caranya kita menambah atau mengurangi hak akses user hanya dengan memilih di cheklist? Jadi setiap aksi seperti edit delete add, dll ....kita bikin checklist? gimana ya ,mas?

Lihat semua 4 jawaban

Silahkan login untuk menjawab!
<?php
$hari_ini = date ("Y-m-d");
$tampil="SELECT * from tblpenghuni ORDER BY id_penghuni";
$hasil=mysql_query($tampil);
$data=mysql_fetch_array($hasil)
?>
&nbsp;&nbsp;&nbsp;
<fieldset>

<form action = "aksi_penghuni.php?module=user&act=input" method="post" onsubmit='return ValidateForm(this)'>
<p><label for="no_ktp">Nomor KTP</label>
<input type="text" name="no_ktp" size="20" maxlength="18" onkeypress="return harusangka(event)"><br /></p>
<p><label for="nama_penghuni">Nama Penghuni</label>
<input type = "text" name = "nama_penghuni" size = "50" maxlength="50"><br /></p>
<p><label for="tempat_lahir">Tempat Lahir</label>
<input type="text" name = "tempat_lahir" size="50" maxlength="30"></input><br /></p>
<p><label for="tgl_lahir">Tanggal Lahir</label>

<select name="tanggal">

<?php

for ($tgl=1; $tgl<=31; $tgl++) {


echo "<option value='$tgl'> $tgl </option>";

}

?>
</select>-
<select name="bln">
<?php
$bulan=array("Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember");
for($i=0;$i<=12;$i++){
echo("<option value='".$bulan[$i]."'>".$bulan[$i]."</option>");
}
?>
</select>
-<select name="tahun">

<?php
$thn_skrg=date("Y");
for ($thn=1970; $thn<=$thn_skrg; $thn++) {

echo "<option value=$thn> $thn </option>";

}

?>

</select> <br /></p>
<p><label for="kelamin">Kelamin</label>
<label><input name="kelamin" type="radio" value="Laki-laki" checked>Laki-laki</label>
<label><input type="radio" name="kelamin" value="Perempuan">Perempuan</label><br /></p>
<p><label for="agama">Agama</label>
<select name="agama" id="agama">
<option>Islam</option>
<option>Kristen Protestan</option>
<option>Kristen Khatolik</option>
<option>Budha</option>
<option>Hindu</option>
</select><br /></p>
<p><label for="id_penghuni">ID Penghuni</label>
<?php
$result = mysql_query("select * from perusahaan");
$jsArray = "var prdName = new Array();\n";
echo '<select name="prdId" onchange="document.getElementById(\'prd_name\').value = prdName[this.value]">';
echo '<option>pilih</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row . '">' . $row . '</option>';
$jsArray .= "prdName . "'] = '" . addslashes($row) . "';\n";
}
echo '</select>';
?>
<input type="text" name="prod_name" id="prd_name"/><br /></p>
<script type="text/javascript">
<?php echo $jsArray; ?>
</script>


<!--<option value="selected">Pilih Perusahaan</option>

<?php
$query= "select * from perusahaan";
$hasil = mysql_query($query);
while ($data = mysql_fetch_array($hasil))
{
echo "<option value='".$data."'>".$data."</option>";
}
?>-->


<p><label for="deposit">Deposit</label>
<input type = "text" name = "deposit" size = "30" maxlength="20" onkeypress="return harusangka(event)"><br /></p>
<p><label for="status_kerja">Status Kerja</label>
<select name="status_kerja" id="status_kerja" >
<option>Permanen</option>
<option>Kontrak</option>
</select><br /></p>
<p><label for="status_aktif">Status</label>
<select name="status_aktif" id="status_aktif" >
<option>Aktif</option>
<option>Tidak aktif</option>
</select><br /></p>
<p><input type="submit" value="Simpan" class="formbutton"> <input type="reset" value="Batal" class="formbutton"></p>
</form>


untuk aksinya seperti ini script yang saya buat
<?php
include "security.php";
require_once("lib/koneksi.php");
DB_CON();
?>
<?php
$module= $_GET[module];
$act = $_GET[act];

//input perusahaan
if($module=='user' AND $act=='input')
{
$no_ktp=$_POST;
$nama_penghuni=$_POST;
$tempat_lahir=$_POST;
$tgl_lahir=$_POST.'-'.$_POST.'-'.$_POST;
$kelamin=$_POST;
$agama=$_POST;
$id_perusahaan=$_POST;
$deposit=$_POST;
$status_kerja=$_POST;
$status_aktif=$_POST;


$tgl_d=substr($tanggal,3,2);
$bln_d=substr($tanggal,0,2);
$thn_d=substr($tanggal,6,4);
$ttl="$tempat, $tgl_lahir";
$tgl_daftar="$thn_d-$bln_d-$tgl_d";

mysql_query("insert into tblpenghuni (no_ktp,nama_penghuni,tempat_lahir,tgl_lahir,kelamin,agama,id_perusahaan,deposit,status_kerja,status_aktif)values('$no_ktp','$nama_penghuni','$tempat_lahir','$tgl_lahir','$kelamin','$agama','$id_perusahaan','$deposit','$status_kerja','$status_aktif')");
echo "<script>alert('Selamat anda telah berhasil menyimpan data penghuni')</script>";
echo"<script>document.location.href=\"tampil_penghuni.php\";</script>";
//header('location: tampil_perusahaan.php');
}
//update perusahaan
if($module=='user' AND $act=='update')
{
$no_ktp=$_POST;
$nama_penghuni=$_POST;
$tempat_lahir=$_POST;
$tgl_lahir=$_POST;
$kelamin=$_POST;
$agama=$_POST;
$id_perusahaan=$_POST;
$deposit=$_POST;
$status_kerja=$_POST;
$status_aktif=$_POST;
$id=$_POST;


$tgl_d=substr($tanggal,3,2);
$bln_d=substr($tanggal,0,2);
$thn_d=substr($tanggal,6,4);
$ttl="$tempat, $tgl_lahir";
$tgl_daftar="$thn_d-$bln_d-$tgl_d";


mysql_query("update tblpenghuni set no_ktp='$no_ktp',nama_penghuni='$nama_penghuni',tempat_lahir='$tempat_lahir',tgl_lahir='$tgl_lahir',kelamin='$kelamin',agama='$agama',id_perusahaan='$id_perusahaan',depsoit='$deposit',status_kerja='$status_kerja',status='$status_aktif' where id_penguni='$id'");
echo "<script>alert('Selamat anda telah berhasil mengubah data penghuni')</script>";
echo"<script>document.location.href=\"tampil_perusahaan.php\";</script>";
//header('location: tampil_perusahaan.php');

}
//hapus user
if($module=='user' AND $act=='hapus')
{
$id=$_GET;
mysql_query("delete from tblpenghuni where id_penghuni='$id'");
echo "<script>alert('Selamat anda telah berhasil menghapus data penghuni')</script>";
echo"<script>document.location.href=\"tampil_penghuni.php\";</script>";

//header('location: tampil_perusahaan.php');

}

?>

Lihat semua 6 jawaban

Silahkan login untuk menjawab!

form pelamar

Powel Muntu · Oct 14, 2012
wuaghh gini pak, saya telah membuat semua fungsinya...trus waktu klik kirim...pesannya berhasil,tapi kok ngak di simpan di mysq...??? padahal koneksinya udah bener...,,

mohon bantuannya..thx
<title>PT.DAYA ADICIPTA WISESA</title>
<form id="Nama" target="" enctype="multipart/form-data" method="post" action="input_registrasi.php" name="localhost">
  <table style="text-align:left;" cellpadding="2" cellspacing="0" border="0" bgcolor="#708090">
    <tr>
      <td style="" colspan="2">
        <font face="Verdana" size="2" color="#000000"><b style="font-size:20px;">Formulir Pendaftaran</b><br />
        <label style="font-size:15px;">PT.DATA ADICIPTA WISESA<br /></label><br /></font>
        <img src="powel.png" width="250" height="103" /></td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_2" style="" align="left"><b><font color="#000000" size="2" face="Verdana">Nama</font></b></td>
      <td id="td_element_field_2" style="">
        <input id="element_2" name="element_2" value="" size="30" class="validate[optional]" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_5" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Tanggal Lahir</b></font>
      </td>
      <td id="td_element_field_5" style="">
        <table cellpadding='0' cellspacing='0' border='0'>
          <tr>
            <td style='padding-left:3px;padding-right:3px;'>
              <select id="element_5_year-dd" name="element_5_day">
                <option value="01">
                  01
                </option>
                <option value="02">
                  02
                </option>
                <option value="03">
                  03
                </option>
                <option value="04">
                  04
                </option>
                <option value="05">
                  05
                </option>
                <option value="06">
                  06
                </option>
                <option value="07">
                  07
                </option>
                <option value="08">
                  08
                </option>
                <option value="09">
                  09
                </option>
                <option value="10">
                  10
                </option>
                <option value="11">
                  11
                </option>
                <option value="12">
                  12
                </option>
                <option value="13">
                  13
                </option>
                <option value="14">
                  14
                </option>
                <option value="15">
                  15
                </option>
                <option value="16">
                  16
                </option>
                <option value="17">
                  17
                </option>
                <option value="18">
                  18
                </option>
                <option value="19">
                  19
                </option>
                <option value="20">
                  20
                </option>
                <option value="21">
                  21
                </option>
                <option value="22">
                  22
                </option>
                <option value="23">
                  23
                </option>
                <option value="24">
                  24
                </option>
                <option value="25">
                  25
                </option>
                <option value="26">
                  26
                </option>
                <option value="27">
                  27
                </option>
                <option value="28">
                  28
                </option>
                <option value="29">
                  29
                </option>
                <option value="30">
                  30
                </option>
                <option value="31">
                  31
                </option>
              </select><br />
              Hari</td>
            <td style="padding-top:5px" valign="top">
              <font face="Verdana" size="2" color="#000000">/</font>
            </td>
            <td style='padding-left:0;padding-right:3px;'>
              <select id="element_5_year-mm" name="element_5_month">
                <option value="01">
                  01
                </option>
                <option value="02">
                  02
                </option>
                <option value="03">
                  03
                </option>
                <option value="04">
                  04
                </option>
                <option value="05">
                  05
                </option>
                <option value="06">
                  06
                </option>
                <option value="07">
                  07
                </option>
                <option value="08">
                  08
                </option>
                <option value="09">
                  09
                </option>
                <option value="10">
                  10
                </option>
                <option value="11">
                  11
                </option>
                <option value="12">
                  12
                </option>
              </select><br />
              Bulan</td>
            <td style="padding-top:5px" valign="top">
              <font face="Verdana" size="2" color="#000000">/</font>
            </td>
            <td style='padding-left:3px;padding-right:3px;'>
              <select id="element_5_year" name="element_5_year">
                <option value="1920">
                  1920
                </option>
                <option value="1921">
                  1921
                </option>
                <option value="1922">
                  1922
                </option>
                <option value="1923">
                  1923
                </option>
                <option value="1924">
                  1924
                </option>
                <option value="1925">
                  1925
                </option>
                <option value="1926">
                  1926
                </option>
                <option value="1927">
                  1927
                </option>
                <option value="1928">
                  1928
                </option>
                <option value="1929">
                  1929
                </option>
                <option value="1930">
                  1930
                </option>
                <option value="1931">
                  1931
                </option>
                <option value="1932">
                  1932
                </option>
                <option value="1933">
                  1933
                </option>
                <option value="1934">
                  1934
                </option>
                <option value="1935">
                  1935
                </option>
                <option value="1936">
                  1936
                </option>
                <option value="1937">
                  1937
                </option>
                <option value="1938">
                  1938
                </option>
                <option value="1939">
                  1939
                </option>
                <option value="1940">
                  1940
                </option>
                <option value="1941">
                  1941
                </option>
                <option value="1942">
                  1942
                </option>
                <option value="1943">
                  1943
                </option>
                <option value="1944">
                  1944
                </option>
                <option value="1945">
                  1945
                </option>
                <option value="1946">
                  1946
                </option>
                <option value="1947">
                  1947
                </option>
                <option value="1948">
                  1948
                </option>
                <option value="1949">
                  1949
                </option>
                <option value="1950">
                  1950
                </option>
                <option value="1951">
                  1951
                </option>
                <option value="1952">
                  1952
                </option>
                <option value="1953">
                  1953
                </option>
                <option value="1954">
                  1954
                </option>
                <option value="1955">
                  1955
                </option>
                <option value="1956">
                  1956
                </option>
                <option value="1957">
                  1957
                </option>
                <option value="1958">
                  1958
                </option>
                <option value="1959">
                  1959
                </option>
                <option value="1960">
                  1960
                </option>
                <option value="1961">
                  1961
                </option>
                <option value="1962">
                  1962
                </option>
                <option value="1963">
                  1963
                </option>
                <option value="1964">
                  1964
                </option>
                <option value="1965">
                  1965
                </option>
                <option value="1966">
                  1966
                </option>
                <option value="1967">
                  1967
                </option>
                <option value="1968">
                  1968
                </option>
                <option value="1969">
                  1969
                </option>
                <option value="1970">
                  1970
                </option>
                <option value="1971">
                  1971
                </option>
                <option value="1972">
                  1972
                </option>
                <option value="1973">
                  1973
                </option>
                <option value="1974">
                  1974
                </option>
                <option value="1975">
                  1975
                </option>
                <option value="1976">
                  1976
                </option>
                <option value="1977">
                  1977
                </option>
                <option value="1978">
                  1978
                </option>
                <option value="1979">
                  1979
                </option>
                <option value="1980">
                  1980
                </option>
                <option value="1981">
                  1981
                </option>
                <option value="1982">
                  1982
                </option>
                <option value="1983">
                  1983
                </option>
                <option value="1984">
                  1984
                </option>
                <option value="1985">
                  1985
                </option>
                <option value="1986">
                  1986
                </option>
                <option value="1987">
                  1987
                </option>
                <option value="1988">
                  1988
                </option>
                <option value="1989">
                  1989
                </option>
                <option value="1990">
                  1990
                </option>
                <option value="1991">
                  1991
                </option>
                <option value="1992">
                  1992
                </option>
                <option value="1993">
                  1993
                </option>
                <option value="1994">
                  1994
                </option>
                <option value="1995">
                  1995
                </option>
                <option value="1996">
                  1996
                </option>
                <option value="1997">
                  1997
                </option>
                <option value="1998">
                  1998
                </option>
                <option value="1999">
                  1999
                </option>
                <option value="2000">
                  2000
                </option>
                <option value="2001">
                  2001
                </option>
                <option value="2002">
                  2002
                </option>
                <option value="2003">
                  2003
                </option>
                <option value="2004">
                  2004
                </option>
                <option value="2005">
                  2005
                </option>
                <option value="2006">
                  2006
                </option>
                <option value="2007">
                  2007
                </option>
                <option value="2008">
                  2008
                </option>
                <option value="2009">
                  2009
                </option>
                <option value="2010">
                  2010
                </option>
                <option value="2011">
                  2011
                </option>
                <option value="2012">
                  2012
                </option>
                <option value="2013">
                  2013
                </option>
                <option value="2014">
                  2014
                </option>
                <option value="2015">
                  2015
                </option>
                <option value="2016">
                  2016
                </option>
                <option value="2017">
                  2017
                </option>
                <option value="2018">
                  2018
                </option>
                <option value="2019">
                  2019
                </option>
                <option value="2020">
                  2020
                </option>
                <option value="2021">
                  2021
                </option>
                <option value="2022">
                  2022
                </option>
                <option value="2023">
                  2023
                </option>
                <option value="2024">
                  2024
                </option>
                <option value="2025">
                  2025
                </option>
                <option value="2026">
                  2026
                </option>
                <option value="2027">
                  2027
                </option>
                <option value="2028">
                  2028
                </option>
                <option value="2029">
                  2029
                </option>
                <option value="2030">
                  2030
                </option>
              </select><br />
              Tahun</td>
          </tr>
        </table>
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_6" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Jenis Kelamin</b></font>
      </td>
      <td id="td_element_field_6" style="">
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_6_0" name="element_6" value="Pria" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;Pria&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_6_1" name="element_6" value="Wanita" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;Wanita&nbsp;</font>
        </div>
        <div style="clear:both;"></div>
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_8" style="" align="left"><b><font color="#000000" size="2" face="Verdana">Alamat</font></b></td>
      <td id="td_element_field_8" style="">
        <input id="element_8" name="element_8" value="" size="30" class="validate[optional]" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_10" style="" align="left"><b><font color="#000000" size="2" face="Verdana">Kota</font></b></td>
      <td id="td_element_field_10" style="">
        <input id="element_10" name="element_10" value="" size="30" class="validate[optional]" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_11" style="" align="left"><b><font color="#000000" size="2" face="Verdana">Provinsi</font></b></td>
      <td id="td_element_field_11" style="">
        <input id="element_11" name="element_11" value="" size="30" class="validate[optional]" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_12" style="" align="left"><b><font color="#000000" size="2" face="Verdana">Kode pos</font></b></td>
      <td id="td_element_field_12" style="">
        <input id="element_12" name="element_12" value="" size="30" class="validate[optional]" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_13" style="" align="left"><b><font color="#000000" size="2" face="Verdana">Negara</font></b></td>
      <td id="td_element_field_13" style="">
        <input id="element_13" name="element_13" value="" size="30" class="validate[optional]" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_14" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Alamat Email</b></font>
      </td>
      <td id="td_element_field_14" style="">
        <input id="element_14" name="element_14" class="validate[optional,custom[email]]" value="" size="30" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_15" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>No Hp</b></font>
      </td>
      <td id="td_element_field_15" style="">
        <input id="element_15" name="element_15" class="validate[optional,custom[telephone]]" value="" size="30" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_16" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>No Telepon</b></font>
      </td>
      <td id="td_element_field_16" style="">
        <input id="element_16" name="element_16" class="validate[optional,custom[telephone]]" value="" size="30" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_17" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>No KTP</b></font>
      </td>
      <td id="td_element_field_17" style="">
        <input id="element_17" name="element_17" class="validate[optional,custom[telephone]]" value="" size="30" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_18" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Pendidikan</b></font>
      </td>
      <td id="td_element_field_18" style="">
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_18_0" name="element_18" value="SMA / SMK" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;SMA / SMK&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_18_1" name="element_18" value="D3" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;D3&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_18_2" name="element_18" value="S1" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;S1&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_18_3" name="element_18" value="S2" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;S2&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_18_4" name="element_18" value="S3" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;S3&nbsp;</font>
        </div>
        <div style="clear:both;"></div>
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_19" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Agama</b></font>
      </td>
      <td id="td_element_field_19" style="">
        <div style="width:100%;padding-bottom:5px;">
          <input name="element_19" type="radio" class="validate[optional]" id="element_19_0" value="Kristen Protestan" /><font face="Verdana" size="2" color="#000000">&nbsp;Kristen
          Protestan&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_19_1" name="element_19" value="Katolik" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;Katolik&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_19_2" name="element_19" value="Hindu" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;Hindu&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_19_3" name="element_19" value="Budha" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;Budha&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_19_4" name="element_19" value="Islam" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;Islam&nbsp;</font>
        </div>
        <div style="clear:both;"></div>
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_20" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Jurusan / Program Study</b></font>
      </td>
      <td id="td_element_field_20" style="">
        <input id="element_20" name="element_20" value="" size="30" class="validate[optional]" type="text" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_21" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Status</b></font>
      </td>
      <td id="td_element_field_21" style="">
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_21_0" name="element_21" value="Belum Menikah" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;Belum Menikah&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_21_1" name="element_21" value="Sudah Menikah" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;Sudah Menikah&nbsp;</font>
        </div>
        <div style="width:100%;padding-bottom:5px;">
          <input id="element_21_2" name="element_21" value="Jand / Duda" class="validate[optional]" type="radio" /><font face="Verdana" size="2" color="#000000">&nbsp;Jand / Duda&nbsp;</font>
        </div>
        <div style="clear:both;"></div>
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_22" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Alasan Anda Melamar Di Perusahaan Kami</b></font>
      </td>
      <td id="td_element_field_22" style="">
        <textarea id="element_22" name="element_22" cols="45" rows="6" class="validate[optional]">
</textarea>
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_23" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Anda Ingin Melamar Sebagai</b></font>
      </td>
      <td id="td_element_field_23" style="">
        <textarea id="element_23" name="element_23" cols="45" rows="1" class="validate[optional]">
</textarea>
        <div style="padding-bottom:8px;color:#000000;">
          <small><font face="Verdana">ingat: sesuaikan dengan permintaan kami atau lihat pada papan lowongan pekerjaan</font></small>
        </div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_24" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Riwayat Pekerjaan Anda</b></font>
      </td>
      <td id="td_element_field_24" style="">
        <textarea id="element_24" name="element_24" cols="70" rows="10" class="validate[optional]">
</textarea>
        <div style="padding-bottom:8px;color:#000000;">
          <small><font face="Verdana">ingat: sebutkan nama perusahaan dan jabatan anda pada saat itu</font></small>
        </div>
      </td>
    </tr>
    <tr valign="top">
      <td id="td_element_label_25" style="" align="left">
        <font face="Verdana" size="2" color="#000000"><b>Upload Foto / Dokumen</b></font>
      </td>
      <td id="td_element_field_25" style="">
        <input id="element_25" name="element_25" class="validate[optional]" type="file" />
        <div style="padding-bottom:8px;color:#000000;"></div>
      </td>
    </tr>
    <tr>
      <td colspan="2" align="left">
        <input name="element_counts" value="26" type="hidden" /> <input name="embed" value="forms" type="hidden" /><input name="Submit" type="submit" value="Kirim" />
      </td>
    </tr>
  </table>Pemberitahuan akan di kirim di email anda
</form>
Powered By Mahasiswa De la salle <a href=https://www.facebook.com/powel.muntu>Powel Muntu</a>
</body>
</html>

<div></div>

Lihat semua 2 jawaban

Silahkan login untuk menjawab!
elseif ($_GET[module]=='uploadkoleksifoto'){
$tmpl_pwd=mysql_query("select * from member where username='$_SESSION[namamember]'");
while($tpl_pwd=mysql_fetch_array($tmpl_pwd)){
$username=$tpl_pwd[username];
$id_member=$tpl_pwd[id_member];
}
function getExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
$filename = stripslashes($_FILES['foto']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png"))
{
echo"Field gambar masih kosong....!!!!<br>Mohon Lengkapi Kembali!!!";
echo"<br><a href=javascript:history.go(-1)><b>Ulangi Lagi</b></a>";
}
else{
        if(is_uploaded_file($_FILES['foto']['tmp_name'])){
          if (isset ($_FILES['foto'])){
              $imagename = stripslashes($_FILES['foto']['name']);
              $source = $_FILES['foto']['tmp_name'];
              $target = "foto-member/".$imagename;
              move_uploaded_file($source, $target);
 
              $imagepath = $imagename;
              $save = "foto-member/" . $imagename; //This is the new file you saving
              $file = "foto-member/" . $imagepath; //This is the original file
 
              list($width, $height) = getimagesize($file) ; 
 
              $modwidth = 500; 
 
              $diff = $width / $modwidth;
 
              $modheight = $height / $diff; 
              $tn = imagecreatetruecolor($modwidth, $modheight) ; 
              $image = imagecreatefromjpeg($file) ; 
              imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; 
 
              imagejpeg($tn, $save, 100) ; 
 
              $save = "foto-member/sml_" . $imagename; //This is the new file you saving
              $file = "foto-member/" . $imagepath; //This is the original file
 
              list($width, $height) = getimagesize($file) ; 
 
              $modwidth = 90; 
 
              $diff = $width / $modwidth;
 
              $modheight = $height / $diff; 
              $tn = imagecreatetruecolor($modwidth, $modheight) ; 
              $image = imagecreatefromjpeg($file) ; 
              imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; 
 
              imagejpeg($tn, $save, 100) ; 
 
          }
		  $query=mysql_query("insert into koleksi_foto (id_member,foto_kecil, foto_besar) values ('$id_member', 'sml_$imagename', '$imagename')") or die (mysql_error());
    echo "<meta http-equiv='refresh' content='0; url=member-$id_member.html'>";
		  }
		  }
}

Gan! ada yg bs bantu kesalahannya dmn...

Lihat semua 1 jawaban

Silahkan login untuk menjawab!
Script 1 Load data dan menyimpan tanpa AJAX.
<?php
require_once( '../opendb.php' );
require_once( '../setudf.php' );

if( isset( $_POST['btn_load'] ) ) {
	if( $_POST['btn_load'] == 'Load File' ) {
		$file = "/barang/ambil.txt";
		$fp = fopen( $file, "r" );
		$data = fread( $fp, filesize( $file ) );
		fclose( $fp );
		$output = str_replace( "\t|\t", ",", $data );
		$output = explode( "\n", $output );
		$date_trans = $POST['txt_date_transfer'];


		//--- Check Double Data
		$double = mysql_query( "SELECT * FROM tb_tes WHERE tgl ='$date_trans'" );
		$hasil  = mysql_num_rows( $double );
		if( $hasil>=1 ) {
			$hapus = "DELETE FROM tb_tes WHERE tgl = '$date_trans'";
			mysql_query( $hapus );
		} else {
		
			foreach($output as $var) {
			$tmp = explode(",", $var);
		
			//-- Fields yang diambil dari file *.txt
			$tanggal = $tmp[0];
			$id = $tmp[1];
			$remaks = $tmp[2];
			$sql = "INSERT INTO tb_tes SET tgl='$tanggal', mem_id='$id', remaks='$remaks'";
			$trans = mysql_query($sql);
			if( $trans )
				echo 'Proses transfer ok! :)'.date_db_to_normal( $date_trans );
			else
				echo 'Proses transfer gagal! :(';
			}
		} 	

	}
}
?>
<link type="text/css" rel="stylesheet" href="/barang/css/radius.css" media="screen"/>

<div id="Radius_1">
<form enctype="multipart/form-data" method="post">
<table cellpadding="0" cellspacing="0" width="100%">
    <tr>
    	<th height="25" colspan="3">:: Tes Transfer Data ::</th>
    </tr>

    <tr>
    	<td>Date Transfer : 
		   <input type="text"
            	   id="txt_date_transfer"
                   name="txt_date_transfer"
                   maxlength="10"
                   size="8"
                   value="<?php echo date('d/m/Y');?>"/>
        </td>
        <td>File Location : 
        	  <input type="hidden"
            	   name="MAX_FILE_SIZE"
                   value="2000000"/>
                  <input type="file"
            	   name="nama_file"/>
        </td>
    </tr>

    <tr>
       	<td colspan="2" align="left">
        	<input type="submit"
            	name="btn_load"
                id="btn_load"
                value="Load File"/>
        </td>
    </tr>

</table>
</form>
</div>

Script 2 Load data dan menyimpan menggunakan AJAX.
<link type="text/css" rel="stylesheet" href="/barang/css/radius.css" media="screen"/>
<div id="Radius_1">
<form enctype="multipart/form-data" method="post">
<table cellpadding="0" cellspacing="0" width="100%">
    <tr>
    	<th height="25" colspan="3">:: Tes Transfer Data ::</th>
    </tr>
    
    <tr>
    	<td>Date Transfer : 
		   <input type="text"
            	   id="txt_date_transfer"
                   name="txt_date_transfer"
                   maxlength="10"
                   size="9"
                   value="<?php echo date('d/m/Y');?>"/>
        </td>
        <td>File Location : 
        	   <input type="hidden"
            	   name="MAX_FILE_SIZE"
                   value="2000000"/>
		   <input type="file"
            	   name="nama_file"
                   value="Browse"/>
        </td>
       	<td>
        	   <input type="submit"
            	   name="btn_load"
                   id="btn_load"
                   value="Load File"
                   onclick="Save_n_transfer_data(); return false;"/>
        </td>
    </tr>

    <tr>
       	<td colspan="3" id="_show_progress" align="center">&nbsp;</td>
    </tr>

</table>
</form>
</div>


ajax.js
var sendReq = getXmlHttpRequestObject(), _save_n_trans='_show_progress';

function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert('Status: Cound not create XmlHttpRequest Object. Consider upgrading your browser.');
	}
}


function Save_n_transfer_data() {
document.getElementById( _save_n_trans ).innerHTML = '<img src="/barang/skin/proses_load.gif">';
if ( sendReq.readyState == 4 || sendReq.readyState == 0 ) {
	sendReq.open( "POST", "/barang/tes/transfer_data_.php", true );
	sendReq.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
	sendReq.onreadystatechange=function() {
	if ( sendReq.readyState == 4 && sendReq.status == 200 ) {
		document.getElementById( 'txt_date_transfer' ).value;
		document.getElementById( 'nama_file' ).value;
		alert( sendReq.responseText );
		document.getElementById( _save_n_trans= ).innerHTML ='';
	}
}
var param = 'txt_date_transfer=' + document.getElementById( 'txt_date_transfer' ).value;
param += '&nama_file=' + document.getElementById( 'nama_file' ).value;
sendReq.send( param );
	}
}


transfer_data_.php
<?php
require_once( '../opendb.php' );
require_once( '../setudf.php' );


$date_transfer = date_to_db( $_POST['txt_date_transfer'] );
$filename = $_FILES['nama_file']['name'];
$tmpName  = $_FILES['nama_file']['tmp_name'];
$fp = fopen( $tmpName, "r" );
$data = fread( $fp, filesize( $tmpName ) );
fclose( $fp );

$output = str_replace( "\t|\t", ",", $data );
$output = explode( "\n", $output );


//--- Check Double Data ----
$double = mysql_query( "SELECT * FROM tb_tes WHERE tgl ='$date_transfer'" );
$hasil  = mysql_num_rows( $double );
if( $hasil>=1 ) {
	$hapus = "DELETE FROM tb_tes WHERE tgl = '$date_transfer'";
	mysql_query( $hapus );
} else {
	
	foreach($output as $var) {
	$tmp = explode(",", $var);
		
	//-- Fields yang Diambil Dari File *.txt
	$tanggal = $tmp[0];
	$id = $tmp[1];
	$remaks = $tmp[2];
	$sql = "INSERT INTO tb_tes SET tgl='$tanggal', mem_id='$id', remaks='$remaks'";
	$trans = mysql_query($sql);
	if( $trans )
		echo 'Proses transfer Oke! :) '.date_db_to_normal( $date_transfer );
	else
		echo 'Proses transfer gagal! :(';
}
?>

Jika Script 1 dijalankan, hasilnya
sempurna, namun jika Script 2 dijalankan datanya
ga kesimpen ke tabel MySql. Mohon bantuannya ya mas
untuk script yang kedua...

Lihat semua 1 jawaban

Silahkan login untuk menjawab!
mas aku mau tanya sedikit, kan ceritanya aku udah bisa combo box nih, nah aku lagi coba data di combo box ini setelah di tampilkan akan diinsert ke tabel lain.
<!DOCTYPE html>
<html lang="en">
<head>
 
	<title>Jquery</title>
	<meta charset="utf-8">
  <link rel="stylesheet" href="css/flexslider.css">
 
 
 
<script language="javascript" src="jquery.js"></script>
<script language="javascript">
function Load(data,primid){
	$('#loading'+data).empty().append('<img src="img/ajax-loader.gif"/>');
	$.post("lo.php",{tipe:data,id:primid},
	function(result){
		$('#cb'+data).html(result);
		$('#loading'+data).empty();
	}
	);
}
$(function(){
	Load('propinsi',0);
 
	$('#cbpropinsi').change(
		function(){			
			if($('#cbpropinsi option:selected').val() !=''){
				Load('lokasi',$('#cbpropinsi option:selected').val());
			}
		}
	);
 
});
</script>
 
 
 
</head>
 
<body>
<!-- The template uses conditional comments to add wrappers div for ie8 and ie7 - just add .ie or .ie7 prefix to your css selectors when needed -->
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
 
	<!-- Header -->
 
	<!-- Server status -->
	<header><div class="container_12">
 
 
 
	</div></header>
	<!-- End server status -->
 
	<!-- Main nav -->
 
 
 
 
<form class="block-content form" action="set.php" id = "form_admin" name = "form_admin">
 
    <h1>Location Management <a href=""><img src="images/icons/fugue/navigation-180.png" width="16" height="16"> Back</a></h1>
 
 
 
    <div class="block-header">Register Location</div>
 
    <div class="columns">
 
        <div class="colx2-left">
 
            <fieldset>
 
                <legend>Profile</legend>
 
 
 
                <table cellpadding="3" class="table-padding">
 
 
					<tr title="Required">
 
                        <td><b>Propinsi</b><span class="required">*</span></td>
 
                        <td>:</td>
 
                        <td><select id="cbpropinsi" name="propinsi" ></select></td>
 
                    </tr>
 
                    <tr title="Required">
 
                        <td><b>Location</b><span class="required">*</span></td>
 
                        <td>:</td>
 
                        <td><select id="cblokasi" name="lokasi" ></select></td>
 
                    </tr>
					
                </table>
 
            </fieldset>
 
        </div>
 
    </div>
 
    <div class="block-footer" style="height:30px;">
 
        &nbsp;
 
        <div class="float-right">
 
            <button type="submit"><img src="images/icons/fugue/tick-octagon.png" name = "save" id ="save" onclick="saveForm(); return false;" width="16" height="16"> Save</button>
 
            <button type="reset" class="grey" onclick="this.form.reset();"><img src="images/icons/fugue/arrow-circle.png" width="16" height="16"> Reset</button>
 
            <button type="reset" class="red" onclick="document.location.href='http:register.php';"><img src="images/icons/fugue/cross-white.png" width="16" height="16"> Cancel</button>
        </div>
 
    </div>
 
 
 
</form>
 
 
 
 
 
<br>
 
<p>
 
    <span class="required">*</span> Required</p>
 
			</div></div>
 
		</section>
 
 
 
		<div class="clear"></div>
 
 
 
 
</body>
</html>

nah ini lo.phpnya
<?php
 
	mysql_connect	('localhost','','');
	mysql_select_db	('java');
 
	if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		$tipedata	= $_POST['tipe'];
		$id			= $_POST['id'];
 
		switch($tipedata){
		
			case 'lokasi':
				$sql='SELECT kode,lokasi FROM '.$tipedata.' WHERE kode_pro = "'.$id.'" ORDER BY lokasi ASC';break;
			case 'propinsi':
				$sql='SELECT idProp,namaPropinsi FROM '.$tipedata.' ORDER BY namaPropinsi ASC';break;
		}
 
		$kueri=mysql_query($sql);
		echo '<option value="">--- Select ---</option>';
		while($row=mysql_fetch_object($kueri)){
			echo '<option value="'.$row->idProp.'">';
			switch($tipedata){
			case 'lokasi':
				echo $row->lokasi;break;
			case 'propinsi':
				echo $row->namaPropinsi;break;
			}
			echo '</option>';
		}
	}
?>

nah ini file prosesnya
<?php

  mysql_connect   ("localhost", "root", "rahasia");
  mysql_select_db ("java");
  
  
  $lokasi      		  = $_GET['lokasi'];
  $propinsi           = $_GET['propinsi'];          
  
  
  $sql = "INSERT INTO hasil VALUES('$propinsi','$lokasi')";

  mysql_query($sql) or die ('GAGAL');
      
    
     
  
   
  
?>      

yang jadi masalah adalah pas di insert, di database hanya muncul di bagian propinsi sedangkan di bagian lokasi tetap kosong,

ini tabel hasil:

1. propinsi
2. lokasi

terima kasih bantuannya
Silahkan login untuk menjawab!