mas ellyx ak minta tolong, ak pengen input data dan save data ya berada dalam 1 hal/page, dan bagian nama scrip yg salah ini yg salh , mhon pencerahan y mas.... :(
<html>
	<head>
	    <style type="text/css">
<!--
.style2 {
	font-size: 12px;
	font-style: italic;
}
.style3 {
	font-size: 24px;
	font-weight: bold;
	color: #FF0000;
}
-->
        </style>
</head>
	   <?php
	   if($_POST){
include "config.php";
	  $tgltrans=$_POST['tgltransaksi'];
	  $tglacara= $_POST['tgl']."-".$_POST['bln']."-".$_POST['thn'];
	  $acara=$_POST['acara'];
	  $hari=$_POST['hari'];
	  $waktu=$_POST['mulai']."-".$_POST['selesai'];
	  $user=$_POST['user'];
	  $nama=$_POST['nama'];
	 $sql = "INSERT INTO pesan (username,instansi,tgltransaksi, acara, tglacara, jmlhari, waktu)
	  value ('$user','$nama','$tgltrans','$acara','$tglacara','$hari','$waktu')";	
	mysql_query($sql)
		or die ("Gagal query ubah : ".mysql_error()); }
		?>
	<?php
	 if($_POST){
include "config.php";
	  $std = $_POST['std'];
			$sqj=mysql_query("select * from pesan order by id desc limit 1");
			$ruk=mysql_fetch_array($sqj);
			$no_urut=$ruk[id];
			$tgltrans=$ruk[tgltransaksi];
			
						$qu=mysql_query("select * from fasilitas where ket='$std'");
						while($ruk=mysql_fetch_array($qu))
						{
						$idfasilitas=$ruk[psewa];
						$nama=$ruk[nama];
						$kate=$ruk[kategori];
						$nama=$ruk[nama];
						$jbarang=$ruk[jbarang];
						$subtotal=$ruk[harga];
 $SQL = "INSERT INTO temp_order (penyewa,psewa,tgltransaksi,nama,kategori,jbarang,jharga)
 	     VALUES ('$no_urut','$idfasilitas','$tgltrans','$nama','$kate','$jsewa','$subtotal')";
      mysql_query($SQL)
	or die ("Gagal query simpan : ".mysql_error());
	}}
?>
    <?php
    if($_POST){
    $op1 = explode('.',$_POST['op1']);
    $acara = $op1[1];
    }
    ?>
    <script type="text/javascript">
    function dik(){
    var a;
    a = document.getElementById('op1').value.split('.');
    document.getElementById('acara').value = a[0];
    }
    </script>
<script type="text/javascript">
function validateForm(){
oSel1 = document.getElementById('op1');
if(oSel1.selectedIndex == 0){return false;}
document.getElementById('form1').action = oSel1.value;
return true;
}
</script>
	<body>
 	<?php include "header.php" ?>
	<?php include "menuuser.php" ?>
	
	<div class="art-content">
	<div class="art-Post">
	<div class="art-Post-body">
	<div class="art-Post-inner" align="center">
		<h2 class="art-PostHeader">
		  <p align="center" class="art-Logo-text"> Data Reservasi </p>
		</h2>
	</div>
		<div class="cleared"></div>
	</div>
	</div>
	<div class="art-Post">
	<div class="art-Post-body">
	<div class="art-Post-inner">
	<div class="art-PostContent">
	
	<?php
	include "config.php";
	
	 $sql = "SELECT * FROM reservasi order by idreservasi desc limit 1";
	 $qry = mysql_query($sql, $koneksi)
		  or die ("Query Gagal ".mysql_error());
	 while($user=mysql_fetch_array($qry)){  ?>
	<form id="form1" name="form1" method="post" action="" target="_self"  onSubmit="return validateForm();">
	  <table width="448" border="0" align="center">
          <tr>
            <td height="26" colspan="2"><div align="center"><span class="style3">Isi Agenda Acara yg Akan dipesan </span> 
                <input name="user" type="hidden" id="user" value="<?php echo $user[username];?>">
                <label>
                <input type="hidden" name="nama" id="nama" value="<?php echo $user[nama];?>">
                </label>
            </div><br></td>
          </tr> <?php } ?>
          <tr>
            <td width="146" height="25"><strong>Acara</strong></td>
            <td width="292"><strong>:
                <label>
<select name="op1" onChange="dik()" id="op1">
  <option value="" selected="selected">.::Pilih Acara::.</option>
  <option value="pernikahan.php">Pernikahan</option>
  <option value="wisuda.php">wisuda</option>
  <option value="seminar.php">Seminar</option>
</select>
<input name="acara" id="acara" type="hidden" value="" size="5" maxlength="5" />
              </label>
            </strong></td>
          </tr>
          <tr>
            <td height="26"><strong>Tanggal</strong></td>
            <td><strong>:            
                <select name="tgl">
                  <option selected="selected">Tanggal</option>
                  <?php
										for($a=1; $a<=31; $a+=1){
										echo"<option value=$a> $a </option>";
										}
									?>
              </select>
                <select name="bln">
										  <option selected="selected">Bulan</option>
									      <?php
										for($a=1; $a<=12; $a+=1){
										echo"<option value=$a> $a </option>";
										}
									?>
              </select>
                <select name="thn">
									  <option selected="selected">Tahun</option>
									  <?php
									$t=date('Y');
										for($i=$t; $i>=1925; $i-=1){
										echo"<option value=$i > $i </option>";
										}
										?>
              </select>
            </strong></td>
          </tr>
          <tr>
            <td height="26"><strong>Jumlah Hari</strong> </td>
            <td><strong>:
              
              
                <select name="hari">
                  <option value="1" selected="selected">1</option>
                  <?php
										for($a=2; $a<=31; $a+=1){
										echo"<option value=$a> $a </option>";
										}
									?>
              </select>
            </strong>
              <label>
              <input name="std" type="hidden" id="std" value="standart" >
            </label></td>
          </tr>
          <tr>
            <td height="29"><strong>Mulai Acara </strong></td>
            <td><strong>:            
                <label>
                <select name="mulai">
                  <option selected >Mulai</option>
                  <option value="06.00 WIB">06.00 WIB</option>
                  <option value="09.00 WIB">09.00 WIB</option>
                  <option value="12.00 WIB">12.00 WIB</option>
                  <option value="15.00 WIB">15.00 WIB</option>
                  <option value="18.00 WIB">18.00 WIB</option>
                  <option value="21.00 WIB">21.00 WIB</option>
                </select>
                </label>
                <span class="style2">s/d</span></strong>            
              <strong>
              <select name="selesai">
                <option selected >Selesai</option>
                <option value="06.00 WIB">06.00 WIB</option>
                <option value="09.00 WIB">09.00 WIB</option>
                <option value="12.00 WIB">12.00 WIB</option>
                <option value="15.00 WIB">15.00 WIB</option>
                <option value="18.00 WIB">18.00 WIB</option>
                <option value="21.00 WIB">21.00 WIB</option>
                <option value="selesai">selesai</option>
              </select>
              </strong></td>
          </tr>
          <tr>
            <td height="26">&nbsp;</td>
            <td><label>
              <input name="tgltransaksi" type="hidden" id="tgltransaksi" value="<?php print date('d-m-Y'); ?>">
              <br>
            </label></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><div align="right">
              <input name="sub" id="sub" type="submit" value="Submit" />
            </div></td>
          </tr>
		 
          <tr>
            <td>&nbsp;</td>
            <td align="right"></td>
          </tr>
        </table>
      </form>

	  	<div class="cleared"></div>
	</div>
		<div class="cleared"></div>
	</div>
	</div>    
	</body>
	
</html>
Silahkan login untuk menjawab!
1
Loading...
Ellyx Christian · Sep 2, 2012 · 1 Suka · 0 Tidak Suka
coba debug kode kamu dengan cara yang saya jelaskan di http://www.myphptutorials.com/questions/input-tidak-sempurna_306.html#answer-anc1602
0
Loading...
ulfa · Sep 5, 2012 · 0 Suka · 0 Tidak Suka
OK sip mas Ellyx, matur thank you :)