Jump to content

havide

New Members
  • Posts

    7
  • Joined

  • Last visited

havide's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I use firebug to detect how javascript work. It same code. the java script : <script type="text/javascript"> $(function() { $("#cmbNegara").change(function(){ $("img#imgLoad").show(); var kodejeniskayu = $(this).val(); $.ajax({ type: "POST", dataType: "html", url: "getProvinsi.php", data: "kodejeniskayu="+kodejeniskayu, success: function(msg){ if(msg == ''){ $("select#cmbProvinsi").html('<option value="">--Pilih Ukuran--</option>'); $("select#cmbKota").html('<option value="">--Pilih Ukuran--</option>'); }else{ $("select#cmbProvinsi").html(msg); } $("img#imgLoad").hide(); getAjaxAlamat(); } }); }); $("#cmbProvinsi").change(getAjaxAlamat); function getAjaxAlamat(){ $("img#imgLoadMerk").show(); var kodeukuran = $("#cmbProvinsi").val(); $.ajax({ type: "POST", dataType: "html", url: "getKota.php", data: "kodeukuran="+kodeukuran, success: function(msg){ if(msg == ''){ $("select#cmbKota").html('<option value="">--Stok Kosong--</option>'); }else{ $("select#cmbKota").html(msg); } $("img#imgLoadMerk").hide(); } }); }; }); </script> getprovinsi.php <?php require_once('Connections/karyo.php'); ?> <?php ini_set('display_errors',0); //ambil parameter $kodejeniskayu = $_POST['kodejeniskayu']; if($kodejeniskayu == ''){ exit; }else{ $sql ="SELECT kodeukuran,ukuran FROM tukuran WHERE kodejeniskayu='$kodejeniskayu'"; $getNamaProvinsi = mysql_query($sql,$karyo) or die ('Query Gagal'); while($data = mysql_fetch_array($getNamaProvinsi)){ echo '<option value="'.$data['kodeukuran'].'">'.$data['ukuran'].'</option>'; } exit; } ?> getkota.php <?php require_once('Connections/karyo.php'); ?> <?php ini_set('display_errors',0); //ambil parameter $kodeukuran = $_POST['kodeukuran']; if($kodeukuran == ''){ exit; }else{ $sql ="SELECT idstok,harga FROM tstok WHERE kodeukuran = '$kodeukuran'"; $getNamaKota = mysql_query($sql,$karyo) or die ('Query Gagal'); while($data = mysql_fetch_array($getNamaKota)){ echo '<option value="'.$data['idstok'].'">'.$data['harga'].'</option>'; } exit; } ?> the problem at online is, the combobox at getprovinsi not showing up.
  2. I think its the apache server version or another thing in 000webhost not giving permission or not compatible to "RewriteRule" because when I change to hostinger with this phpinfo, all my .htaccess work here. Any Suggestion? btw, thanks Ch0cu3r for your respond, it help.
  3. this is the result, apache 2.0 handler. is't right? I think the .htaccess file worked and readed because if I put in my .htaccess code : DirectoryIndex main/home.php at first line, it work and my homepage showed, but not the other page because the "RewriteRule".
  4. I have create a working site at localhost but when I upload it to webhost, it's not working, all link broken. This is the site. this is the directory : The index.php content is : <?php header('location:home.html'); ?> and the .htaccess content is : RewriteEngine on RewriteRule ^home.html$ main/home.php?main=home [L] RewriteRule ^penyakit.html$ main/home.php?main=penyakit [L] RewriteRule ^review-(.*)\.html$ main/home.php?main=detilgejala&id=$1 [L] RewriteRule ^solusi.html$ main/home.php?main=solusi [L] RewriteRule ^proses$ main/home.php?main=prosessolusi [L] RewriteRule ^bukutamu.html$ main/home.php?main=bukutamu [L] RewriteRule ^send-contact$ main/main_bukutamu/proses_bukutamu.php [L] RewriteRule ^about.html$ main/home.php?main=about [L] RewriteRule ^ensiklopedia.html$ main/home.php?main=ensiklopedia [L] Options All -indexes This config work in localhost. Thanks for your attention and respond, it help me so much and sorry for the topic's title can't edited it.
  5. I think its good and I will try it. Thx
  6. thanks for advice mac_gyver, i already read it before post it, actually i have no idea about how to implement to my code. I also got another sample from friend with using for(start,condition,amount) {statement;}. I think I need work hard to solve this.
  7. I have problem how to saving all my record. when I save I just got 1 record saved in mySQL and it the last record on that table. Here is my code = <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO thasil (nrp, nama, pangkat, mgolongan, mtes_fisik, mkemampuan, hasil) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['nrp'], "int"), GetSQLValueString($_POST['nama'], "text"), GetSQLValueString($_POST['pangkat'], "text"), GetSQLValueString($_POST['mgolongan'], "int"), GetSQLValueString($_POST['mtes_fisik'], "double"), GetSQLValueString($_POST['mkemampuan'], "double"), GetSQLValueString($_POST['hasil'], "double")); mysql_select_db($database_stok, $stok); $Result1 = mysql_query($insertSQL, $stok) or die(mysql_error()); $insertGoTo = ""; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_stok, $stok); $query_anggotaset = "SELECT * FROM tanggota ORDER BY nrp ASC"; $anggotaset = mysql_query($query_anggotaset, $stok) or die(mysql_error()); $row_anggotaset = mysql_fetch_assoc($anggotaset); $totalRows_anggotaset = mysql_num_rows($anggotaset); mysql_select_db($database_stok, $stok); $query_bobotset = "SELECT * FROM tbobot"; $bobotset = mysql_query($query_bobotset, $stok) or die(mysql_error()); $row_bobotset = mysql_fetch_assoc($bobotset); $totalRows_bobotset = mysql_num_rows($bobotset); $crMax = mysql_query("SELECT min(Golongan) as minK1, max(tes_fisik) as maxK2, max(kemampuan) as maxK3 FROM tanggota"); $max = mysql_fetch_array($crMax); $no=1; ?> <?php include ('header.php') ?> <div id="conten-wrapper"> <div id="conten"> <h1> Normalisasi Anggota Kesamaptaan </h1> <p> <a href="cetak.php"><img src="../images/btn_list.png" height="20"/> >>> Lihat & Cetak Hasil Akhir Perangkingan</a></p> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table border="1" cellpadding="3" cellspacing="1"> <tr> <td>no</td> <td>nrp</td> <td>nama</td> <td>pangkat</td> <td>C1 Golongan</td> <td>C2 tes_fisik</td> <td>C3 kemampuan</td> <td>hasil</td> </tr> <?php do { $hasil= round (($max['minK1']/$row_anggotaset['Golongan']*$row_bobotset['golongan']+ $row_anggotaset['tes_fisik']/$max['maxK2']*$row_bobotset['tes_fisik']+ $row_anggotaset['kemampuan']/$max['maxK3']*$row_bobotset['kemampuan']),2) ; ?> <tr> <td><?php echo $no; $no++;?></td> <td><input type="text" name="nrp" value="<?php echo $row_anggotaset['nrp']; ?>" readonly/></td> <td><input type="text" name="nama" value="<?php echo $row_anggotaset['nama']; ?>" readonly/></td> <td><input type="text" name="pangkat" value="<?php echo $row_anggotaset['pangkat']; ?>" size="4" readonly/></td> <td><input type="text" name="mgolongan" value="<?php echo round ($max['minK1']/$row_anggotaset['Golongan'] *$row_bobotset['golongan'],2); ?>" size="2" readonly/></td> <td><input type="text" name="mtes_fisik" value="<?php echo round ($row_anggotaset['tes_fisik']/$max['maxK2'] *$row_bobotset['tes_fisik'],2); ?>" size="2" readonly/></td> <td><input type="text" name="mkemampuan" value="<?php echo round ($row_anggotaset['kemampuan']/$max['maxK3'] *$row_bobotset['kemampuan'],2); ?>" size="3" readonly/></td> <td><input type="text" name="hasil" value="<?php echo $hasil ?>" size="2" readonly/></td> </tr> <?php } while ($row_anggotaset = mysql_fetch_assoc($anggotaset));?> <tr valign="baseline"> <td colspan="8" align="right" nowrap="nowrap"><input type="submit" value="Insert record" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> </div> <?php include ('footer.php') ?> </body> </html> <?php mysql_free_result($anggotaset); mysql_free_result($bobotset); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.