data tidak masuk ke database

sudah 2 hari lebih, saya melihat coding php yg telah saya buat, namun masih belum menemukan titik terang, dimohon bagi teman2x sudi untuk membantu atau sedikit meluangkan waktu, untuk mengkoreksi, dibagian manakah yang bermasalah,..

problemnya : data setelah di submit tidak masuk ke database.

mohon pencerahannya, terima kasih

 <?php

include 'koneksi.php';
$id_cycle=$_POST['id_cycle'];
$periode=$_POST['periode'];
$nm_cycle=$_POST['nm_cycle'];
$id_cust=$_POST['id_cust'];
$id_dest=$_POST['id_dest'];
$timepull=$_POST['timepull'];
$timedelv=$_POST['timedelv'];
$target_wkt=$_POST['target_wkt'];
$id_process=$_POST['id_process'];
$id_model=$_POST['id_model'];
$id_route=$_POST['id_route'];
$id_plant=$_POST['id_plant'];

mysqli_query($con, "INSERT INTO cycle (periode,nm_cycle,id_cust,id_dest,timepull,timedelv,target_wkt,id_process,id_model,id_route,id_plant)
	VALUES('$periode','$nm_cycle','$id_cust','$id_dest','$timepull','$timedelv','$target_wkt','$id_process','$id_model','$id_route','$id_plant')");

header("location:dp_cycle.php");
?>
 <div class="row">
	  <div class="col-xs-6">
		<div class="form-group">
			<label>Periode : </label>
				<div class="form-group">
					<div class="input-group" id="month">
						<span class="input-group-addon">
							<span class="glyphicon glyphicon-calendar"></span>
						</span>
						<input class="form-control" name="periode" />
					</div>
			   </div>
			</div>
		</div>
			<div class="col-xs-6">
				<div class="form-group">
					<label>Cycle : </label>
						<div class="form-group">
							<div class="input-group" >
								<span class="input-group-addon">
									<span class="glyphicon glyphicon-refresh"></span>
								</span>
					<select class="form-control" name="nm_cycle" >
						<?php
							$cycle=mysqli_query($con, "SELECT nm_cycle FROM cycle");
							while($c=mysqli_fetch_array($cycle)){
						?>
						<option value="<?php echo $c['nm_cycle']; ?>"><?php echo $c['nm_cycle'] ?> </option>
						<?php
						}
						?>
					</select>
				 	</div>
			    </div>
			 </div>
		  </div>
	    </div>
		<div class="row">
		  <div class="col-xs-6">
			 <div class="form-group">
			 	<label>Customer :</label>
					  <div class="input-group">
						<div class="input-group-addon">
						<span class="glyphicon glyphicon-user"></span>
				   	</div>
						<select class="form-control" name="id_cust">
						<option value="">**--PILIH CUSTOMER--**</option>
						<?php
						 	$cust = mysqli_query($con, "SELECT * FROM cust");
						 	 while($cu = mysqli_fetch_array($cust)){
							echo'<option value="'.$cu['id_cust'].'">'.$cu['nm_cust'].'</option>';
						  }
						?>
					</select>
					</div>
				</div>
			</div>
			<div class="col-xs-6">
				<div class="form-group">
					<label>Destinasi :</label>
					<div class="input-group">
					  <div class="input-group-addon">
						<i class="glyphicon glyphicon-home"></i>
					  </div>
		 				<select class="form-control" name="id_dest">
		 				<option value="">**--PILIH DESTINASI--**</option>
						<?php
						 	$dest = mysqli_query($con, "SELECT * FROM dest");
						 	 while($ds = mysqli_fetch_array($dest)){
							echo'<option value="'.$ds['id_dest'].'">'.$ds['nm_dest'].'</option>';
						  }
						?>
						</select>
					</div>
				  </div>
				</div>
			</div>

		<div class="row">
			<div class="col-xs-4">
			  <div class="form-group">
				<label> Standart Waktu Pulling:</label>
					<div class='input-group date'>
						<span class="input-group-addon">
							<span class="glyphicon glyphicon-time"></span>
						</span>
					<input type="text" class="form-control" name="timepull" />
					  </div>
				   </div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label>Standart Waktu Delivery:</label>
							<div class='input-group date'>
								<span class="input-group-addon">
								   <span class="glyphicon glyphicon-time"></span>
								 </span>
									<input type="text" class="form-control" name="timedelv">
									</div>
				   				</div>
							</div>
					 <div class="col-xs-4">
						 <div class="form-group">
							<label>Target waktu:</label>
								<div class='input-group date'>
								<span class="input-group-addon">
							   		<span class="glyphicon glyphicon-time"></span>
								 </span>
								<input type="text" class="form-control" name="target_wkt">
							</div>
						</div>
					 </div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<label>Process :</label>
						<div class="input-group">
						  <div class="input-group-addon">
							<i class="glyphicon glyphicon-exclamation-sign"></i>
						  </div>
			 				<select class="form-control" name="id_process">
			 					<option value="">** PILIH Process **</option>
							<?php
						 	$proc = mysqli_query($con, "SELECT * FROM proces");
						 	 while($pr = mysqli_fetch_array($proc)){
							echo'<option value="'.$pr['id_process'].'">'.$pr['nm_process'].'</option>';
						  }
						?>
					   </select>
					</div>
				</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label>Model :</label>
								<div class="input-group">
									<div class="input-group-addon">
										<span class="glyphicon glyphicon-tag"></span>
									</div>
							<select class="form-control" name="id_model">
								<option value="">** PILIH Model **</option>
							<?php
						 	$mod = mysqli_query($con, "SELECT * FROM model");
						 	 while($m = mysqli_fetch_array($mod)){
							echo'<option value="'.$m['id_model'].'">'.$m['nm_model'].'</option>';
						  }
						?>
					 	 </select>
					</div>
				</div>
			</div>
		</div>
			<div class="row">
			 	<div class="col-xs-6">
				   <div class="form-group">
				   	 <label>Ruote :</label>
						<div class="input-group">
							<div class="input-group-addon">
							<span class="glyphicon glyphicon-tag"></span>
							</div>
					 <select class="form-control" name="id_route">
					 	<option value="">** PILIH Route **</option>
						<?php
						 	$rout = mysqli_query($con, "SELECT * FROM route");
						 	 while($r = mysqli_fetch_array($rout)){
							echo'<option value="'.$r['id_route'].'">'.$r['nm_route'].'</option>';
						  }
						?>
					</select>
					</div>
				</div>
			</div>
			 	<div class="col-xs-6">
				   <div class="form-group">
				   	 <label>Plant :</label>
						<div class="input-group">
							<div class="input-group-addon">
							<span class="glyphicon glyphicon-tag"></span>
							</div>
						 <select class="form-control" name="id_plant">
						 	<option value="">** PILIH Plant **</option>
						<?php
						 	$plan = mysqli_query($con, "SELECT * FROM plant");
						 	 while($pl = mysqli_fetch_array($plan)){
							echo'<option value="'.$pl['id_plant'].'">'.$pl['nm_plant'].'</option>';
						  }
						?>
					</select>
					</div>
				</div>
			</div>
		  </div>
				<div class="modal-footer">
	   				<button class="btn btn-success" type="submit"> TAMBAH </button>
	      			<button type="reset" class="btn btn-danger" data-dismiss="modal" aria-hidden="true">BATAL</button>
	  			</div>
	     	  </div>
	        </form>
	      </div>
	    </div>

struktur databse :

terima kasih,.. salam

avatar gopei
@gopei

71 Kontribusi 1 Poin

Diperbarui 6 tahun yang lalu

10 Jawaban:

tag &lt;form&gt; diatas ada kan? coba <pre> mysqli_query($con,.......); //tambahkan ini die("INSERT INTO cycle (periode,nm_cycle,id_cust,id_dest,timepull,timedelv,target_wkt,id_process,id_model,id_route,id_plant) VALUES('$periode','$nm_cycle','$id_cust','$id_dest','$timepull','$timedelv','$target_wkt','$id_process','$id_model','$id_route','$id_plant')"); </pre> terus jalankan manual ke database

avatar dianarifr
@dianarifr

642 Kontribusi 316 Poin

Dipost 6 tahun yang lalu

saya coba cara manual ke Database, seperti ini masuk ..

<pre> INSERT INTO cycle (periode,nm_cycle,id_cust,id_dest,timepull,timedelv,target_wkt,id_process,id_model,id_route,id_plant) VALUES('september-2018','CYCLE-1','16','114','20:40 - 23:50','03:33','03:03','1','27','34','6'); </pre>

lalu, selanjutnya, cek apanya lagi ya??? makasih

avatar gopei
@gopei

71 Kontribusi 1 Poin

Dipost 6 tahun yang lalu

apakah itu hasil dari die() diatas? atau ditulis manual? apakah ada error yg lain?

avatar dianarifr
@dianarifr

642 Kontribusi 316 Poin

Dipost 6 tahun yang lalu

manual kak bukan dari hasil die() diatas... coba sy coba yang dari die

avatar gopei
@gopei

71 Kontribusi 1 Poin

Dipost 6 tahun yang lalu

<pre> mysqli_query($con,...); die("INSERT INTO cycle (periode,nm_cycle,id_cust,id_dest,timepull,timedelv,target_wkt,id_process,id_model,id_route,id_plant) VALUES('$periode','$nm_cycle','$id_cust','$id_dest','$timepull','$timedelv','$target_wkt','$id_process','$id_model','$id_route','$id_plant')"); </pre>

hasil nya : Parse error: syntax error, unexpected ')' in D:\xampp\htdocs\part_monitoring_system\admin\dp_cycle_add.php on line 17..

gitu bukan kak ?

avatar gopei
@gopei

71 Kontribusi 1 Poin

Dipost 6 tahun yang lalu

coba echo aja gan <pre> echo "INSERT INTO cycle (periode,nm_cycle,id_cust,id_dest,timepull,timedelv,target_wkt,id_process,id_model,id_route,id_plant) VALUES('$periode','$nm_cycle','$id_cust','$id_dest','$timepull','$timedelv','$target_wkt','$id_process','$id_model','$id_route','$id_plant')"; </pre>

avatar dianarifr
@dianarifr

642 Kontribusi 316 Poin

Dipost 6 tahun yang lalu

coba di cek dulu methodnya post bukan

avatar bosque
@bosque

187 Kontribusi 104 Poin

Dipost 6 tahun yang lalu

@diana,.. masih belum muncul gak Diana,..

@bosgue,... Methodnya POST kak,

<pre> &lt;form action="dp_cycle_add.php" name="modal_popup" enctype="multipart/form-data" method="post"&gt; </pre>

makasih @bosgue, @diana,...

avatar gopei
@gopei

71 Kontribusi 1 Poin

Dipost 6 tahun yang lalu

coba <pre> include 'koneksi.php'; $id_cycle=$_POST['id_cycle']; $periode=$_POST['periode']; $nm_cycle=$_POST['nm_cycle']; $id_cust=$_POST['id_cust']; $id_dest=$_POST['id_dest']; $timepull=$_POST['timepull']; $timedelv=$_POST['timedelv']; $target_wkt=$_POST['target_wkt']; $id_process=$_POST['id_process']; $id_model=$_POST['id_model']; $id_route=$_POST['id_route']; $id_plant=$_POST['id_plant'];

mysqli_query($con, "INSERT INTO cycle (periode,nm_cycle,id_cust,id_dest,timepull,timedelv,target_wkt,id_process,id_model,id_route,id_plant) VALUES('$periode','$nm_cycle','$id_cust','$id_dest','$timepull','$timedelv','$target_wkt','$id_process','$id_model','$id_route','$id_plant')");

// hasil ini coba masukkan manual ke database, apakah ada error atau tidak echo "INSERT INTO cycle (periode,nm_cycle,id_cust,id_dest,timepull,timedelv,target_wkt,id_process,id_model,id_route,id_plant) VALUES('$periode','$nm_cycle','$id_cust','$id_dest','$timepull','$timedelv','$target_wkt','$id_process','$id_model','$id_route','$id_plant')";

//header("location:dp_cycle.php"); //&lt;-- ini di comment, biar tau hasil echonya</pre>

avatar dianarifr
@dianarifr

642 Kontribusi 316 Poin

Dipost 6 tahun yang lalu

telah Solved,.. thanks @dianarifr

avatar gopei
@gopei

71 Kontribusi 1 Poin

Dipost 6 tahun yang lalu

Login untuk ikut Jawaban