Menampilkan data yang akan di input menggunakan Textfield dengan Dreamweaver,PHP dan MYSQL

Selamat siang, saya mau bertanya tentang bagaimana cara menampilkan data dari salah satu tabel database menggunakan textfield lalu menginputnya ke tabel yang lain,saya menguanakan DW berikut coding untuk form input data nya:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">
body,td,th {
	color: #000000;
}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>INPUT ADS LINE</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
$open = mysql_connect ("localhost","root","");
mysql_select_db("db_ads1",$open) or die ("Koneksi gagal");
?>

<title>Data ADS Line</title>
<style type="text/css" media="screen">
	table{font-family:Verdana, Geneva, sans-serif; font-size:11px;}
	input{font-family:Verdana, Geneva, sans-serif; font-size:11px; height:20px;}
</style>
</head>
<body>
<h4 align="center">Input ADS Line</h4>
<p><a href="data_adsline_m.php">ads line</a></p>
<form method = 'POST' action = 'aksi_tambah.php'>
<table width="30%" border="0">
  <tr>
    <td width="17%">NIK</td>
    <td width="3%">:</td>
    <td width="80%">
    <input type="text" disabled="disabled" value="" />
    </td>
  </tr>
  <tr>
    <td>NCVS</td>
    <td>:</td>
    <td>
    <input type="text" disabled="disabled" value="" />
    </td>
  </tr>
  <tr>
    <td>Style</td>
    <td>:</td>
    <td>

    </td>
  </tr>
</table>
</form>
<div style="border:0; padding:10xp; width:100%; height:auto;">
    <table width="100%" height="100%" border="0">
  		<tr>
    		<td>
			  <table width="100%" border="0">
  					<tr>
   					  <th width="82%" height="30" nowrap="nowrap" bgcolor="#0033FF" scope="col"><h1>Rework</h1></th>
    					<th bgcolor="#FF0000" scope="col"><h1>C-Grade</h1></th>
					</tr>
  					<tr>
    					<td height="100%" valign="top" bgcolor="#3399FF">
                        	<table height="100%" width="100%" border="0">
  								<tr height="20%">
    								<td>
                                    <table width="100%" border="0">
  										<tr>
    										<td align="center">
                                            <form action="input_adsline/R1.php" method="post" name="Tip Shape">
												<input type="submit" name="Submit" value="Tip Shape" style="height:40px; width:130px;">
  											</form>
                                            </td>
    										<td align="center">
                                            <form action="input_adsline/R2.php" method="post" name="Eye Stay Position">
												<input type="submit" name="Submit" value="Eye Stay Position" style="height:40px; width:130px;">
  											</form>
                                            </td>
    										<td align="center">
                                            <form action="input_adsline/R3.php" method="post" name="Wrinkle">
												<input type="submit" name="Submit" value="Wrinkle" style="height:40px; width:130px;">
  											</form>
                                            </td>
  										</tr>
									</table>
                                  </td>
    								<td>
                                    <table width="100%" border="0">
    									<tr>
    								    	<td align="center">
                                            <form action="input_adsline/R4.php" method="post" name="Swoosh Shape">
												<input type="submit" name="Submit" value="Swoosh Shape" style="height:40px; width:130px;">
  											</form>
                                            </td>
    								    	<td align="center">
                                            <form action="input_adsline/R5.php" method="post" name="Tongue Shape">
												<input type="submit" name="Submit" value="Tongue Shape" style="height:40px; width:130px;">
  											</form>
                                            </td>
    								    	<td align="center">
                                            <form action="input_adsline/R6.php" method="post" name="Collar Shape">
												<input type="submit" name="Submit" value="Collar Shape" style="height:40px; width:130px;">
  											</form>
                                            </td>
  								  		</tr>
  								  </table></td>
  								</tr>
  								<tr height="40%">
    								<td valign="top"><table height="100%" width="100%" border="0" bgcolor="#CC33FF">
    								  <tr>
    								    <td height="22" bgcolor="#CC33FF" align="center"><h2>Stitching Margin :</h2></td>
  								    </tr>
  								  </table>
    								  <table width="100%" height="17%" border="0" bgcolor="#CC99FF">
    								    <tr>
    								      <td align="center" valign="baseline">
                                          	<form action="input_adsline/RSM1.php" method="post" name="Tip">
												<input type="submit" name="Submit" value="Tip" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSM2.php" method="post" name="Quarter">
												<input type="submit" name="Submit" value="Quarter" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSM3.php" method="post" name="Eye Stay">
												<input type="submit" name="Submit" value="Eye Stay" style="height:40px; width:130px;">
  											</form>
                                          </td>
    								      <td align="center" valign="baseline">
                                          	<form action="input_adsline/RSM4.php" method="post" name="Back Tab">
												<input type="submit" name="Submit" value="Back Tab" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSM5.php" method="post" name="Swoosh">
												<input type="submit" name="Submit" value="Swoosh" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSM6.php" method="post" name="Tongue">
												<input type="submit" name="Submit" value="Tongue" style="height:40px; width:130px;">
  											</form>
                                          </td>
                                          <td align="center" valign="baseline">
                                          	<form action="input_adsline/RSM7.php" method="post" name="Foxing">
												<input type="submit" name="Submit" value="Foxing" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSM8.php" method="post" name="Vamp">
												<input type="submit" name="Submit" value="Vamp" style="height:40px; width:130px;">
  											</form>
                                          </td>
  								      </tr>
							      </table></td>
    								<td height="40%" valign="top" bgcolor="#3399FF">
                                    <table height="22" width="100%" border="0" bgcolor="#FF9900">
    								  <tr>
    								    <td height="22" align="center"><h2>Thread End :</h2></td>
  								    </tr>
  								  </table>
                                    <table width="100%" height="17%" border="0" bgcolor="#FFCC66">
                                      <tr>
                                        <td align="center" valign="baseline">
                                       	  <form action="input_adsline/RTE1.php" method="post" name="Tip">
												<input type="submit" name="Submit" value="Tip" style="height:40px; width:130px;">
										  </form>
                                          <form action="input_adsline/RTE2.php" method="post" name="Quarter">
												<input type="submit" name="Submit" value="Quarter" style="height:40px; width:130px;">
										  </form>
                                          <form action="input_adsline/RTE3.php" method="post" name="Eye Stay">
												<input type="submit" name="Submit" value="Eye Stay" style="height:40px; width:130px;">
										  </form>
                                        </td>
                                        <td align="center" valign="baseline">
                                       	  <form action="input_adsline/RTE4.php" method="post" name="Back Tab">
												<input type="submit" name="Submit" value="Back Tab" style="height:40px; width:130px;">
  											</form>
                                          <form action="input_adsline/RTE5.php" method="post" name="Swoosh">
												<input type="submit" name="Submit" value="Swoosh" style="height:40px; width:130px;">
  											</form>
                                          <form action="input_adsline/RTE6.php" method="post" name="Tongue">
												<input type="submit" name="Submit" value="Tongue" style="height:40px; width:130px;">
										  </form>
                                        </td>
                                        <td align="center" valign="baseline">
                                       	  <form action="input_adsline/RTE7.php" method="post" name="Foxing">
												<input type="submit" name="Submit" value="Foxing" style="height:40px; width:130px;">
										  </form>
                                          <form action="input_adsline/RTE8.php" method="post" name="Vamp">
												<input type="submit" name="Submit" value="Vamp" style="height:40px; width:130px;">
										  </form>
                                        </td>
                                      </tr>
                                  </table></td>
 								</tr>
  								<tr height="40%">
    								<td valign="top">
                                    <table height="85%"width="100%" border="0" bgcolor="#FF6699">
    								  <tr>
    								    <td height="22" align="center"><h2>Stain Upper :</h2></td>
  								    </tr>
  								  </table>
    								  <table width="100%" height="17%" border="0" bgcolor="#FF99CC">
    								    <tr>
    								      <td align="center" valign="baseline">
                                          	<form action="input_adsline/RSU1.php" method="post" name="Tip">
												<input type="submit" name="Submit" value="Tip" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSU2.php" method="post" name="Quarter">
												<input type="submit" name="Submit" value="Quarter" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSU3.php" method="post" name="Eye Stay">
												<input type="submit" name="Submit" value="Eye Stay" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSU4.php" method="post" name="Back Tab">
												<input type="submit" name="Submit" value="Back Tab" style="height:40px; width:130px;">
  											</form>
                                        </td>
    								      <td align="center" valign="baseline">
                                          	<form action="input_adsline/RSU5.php" method="post" name="Swoosh">
												<input type="submit" name="Submit" value="Swoosh" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSU6.php" method="post" name="Tongue">
												<input type="submit" name="Submit" value="Tongue" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSU7.php" method="post" name="Foxing">
												<input type="submit" name="Submit" value="Foxing" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RSU8.php" method="post" name="Vamp">
												<input type="submit" name="Submit" value="Vamp" style="height:40px; width:130px;">
  											</form>
                                        </td>
                                        <td align="center" valign="baseline">
                                       	  <form action="input_adsline/RSU9.php" method="post" name="Shoelace">
												<input type="submit" name="Submit" value="Shoelace" style="height:40px; width:130px;">
										  </form>
                                          <form action="input_adsline/RSU10.php" method="post" name="Unclean Pounching">
												<input type="submit" name="Submit" value="Unclean Pounching" style="height:40px; width:130px;">
										  </form>
                                        </td>
  								      </tr>
							      </table></td>
    								<td valign="top">
                                    <table height="22"width="100%" border="0" bgcolor="#00CC00">
    								  <tr>
    								    <td height="22" align="center"><h2>Un Standart SPI :</h2></td>
  								    </tr>
  								  </table>
    								  <table width="100%" height="89%" border="0" bgcolor="#00FF99" >
    								    <tr>
    								      <td align="center" valign="baseline">
                                          	<form action="input_adsline/RUSSPI1.php" method="post" name="Tip">
												<input type="submit" name="Submit" value="Tip" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RUSSPI2.php" method="post" name="Quarter">
												<input type="submit" name="Submit" value="Quarter" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RUSSPI3.php" method="post" name="Eye Stay">
												<input type="submit" name="Submit" value="Eye Stay" style="height:40px; width:130px;">
  											</form>
                                        </td>
                                        <td align="center" valign="baseline">
                                          	<form action="input_adsline/RUSSPI4.php" method="post" name="Back Tab">
												<input type="submit" name="Submit" value="Back Tab" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RUSSPI5.php" method="post" name="Swoosh">
												<input type="submit" name="Submit" value="Swoosh" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RUSSPI6.php" method="post" name="Tongue">
												<input type="submit" name="Submit" value="Tongue" style="height:40px; width:130px;">
  											</form>
                                        </td>
    								      <td align="center" valign="baseline">
                                          	<form action="input_adsline/RUSSPI7.php" method="post" name="Foxing">
												<input type="submit" name="Submit" value="Foxing" style="height:40px; width:130px;">
  											</form>
                                            <form action="input_adsline/RUSSPI8.php" method="post" name="Vamp">
												<input type="submit" name="Submit" value="Vamp" style="height:40px; width:130px;">
  											</form>
                                        </td>
  								      </tr>
							      </table>
                                  </td>
  								</tr>
                                <tr>
                                	<td>
                                    <table height="85%"width="100%" border="0" bgcolor="#8D8D8D">
    								  <tr>
    								    <td height="22" align="center"><h2>Foxing/Back Tab :</h2></td>
  								    </tr>
  								  </table>
    								  <table width="100%" height="17%" border="0" bgcolor="#C9C9C9">
    								    <tr>
    								      <td align="center" valign="baseline">
                                          <form action="input_adsline/RFB1.php" method="post" name="Off">
												<input type="submit" name="Submit" value="Off" style="height:40px; width:130px;">
  											</form>
                                          </td>
    								      <td align="center" valign="baseline">
                                          <form action="input_adsline/RFB2.php" method="post" name="Crooked">
												<input type="submit" name="Submit" value="Crooked" style="height:40px; width:130px;">
  											</form>
                                          </td>
                                          <td align="center" valign="baseline">
                                          <form action="input_adsline/RFB3.php" method="post" name="X Ray">
												<input type="submit" name="Submit" value="X Ray" style="height:40px; width:130px;">
  											</form>
                                          </td>
  								      </tr>
							      </table>
                                	</td>
                                	<td align="center" valign="middle">
                                    <form action="input_adsline/RETC.php" method="post" name="Etc">
										<input type="submit" name="Submit" value="Etc" style="height:40px; width:400px;">
  									</form>
                                	</td>
                                </tr>
							</table>

                        </td>
    					<td align="center" valign="baseline" bgcolor="#FF0033">
                        <form action="input_adsline/C-Grade1.php" method="post" name="Broken Stitching">
							<input type="submit" name="Submit" value="Broken Stitching" style="height:40px; width:130px;">
  						</form><br />
                        <form action="input_adsline/C-Grade2.php" method="post" name="Loose Stitching">
							<input type="submit" name="Submit" value="Loose Stitching" style="height:40px; width:130px;">
  						</form><br />
                        <form action="input_adsline/C-Grade3.php" method="post" name="Damage Material">
							<input type="submit" name="Submit" value="Damage Material" style="height:40px; width:130px;">
  						</form><br />
                        <form action="input_adsline/C-Grade4.php" method="post" name="Stain Ink">
							<input type="submit" name="Submit" value="Stain Ink" style="height:40px; width:130px;">
  						</form><br />
                        <form action="input_adsline/C-Grade5.php" method="post" name="Stitching Margin">
							<input type="submit" name="Submit" value="Stitching Margin" style="height:40px; width:130px;">
  						</form><br />
                        <form action="input_adsline/C-Grade6.php" method="post" name="Crooked">
							<input type="submit" name="Submit" value="Crooked" style="height:40px; width:130px;">
  						</form><br />
                        <form action="input_adsline/C-Grade7.php" method="post" name="Wrinkle">
							<input type="submit" name="Submit" value="Wrinkle" style="height:40px; width:130px;">
  						</form><br />
                        <form action="input_adsline/C-Grade8.php" method="post" name="Etc">
							<input type="submit" name="Submit" value="Etc" style="height:40px; width:130px;">
  						</form>
                      </td>
				  </tr>

			  </table>
            </td>
  		</tr>
        <tr>
        	<td>
        		<table width="100%" border="0">
  					<tr>
    					<td align="center" width="100%" height="30" border="0" bgcolor="#00FF99">
						 <form action="input_adsline/Pass.php" method="post" name="pass">
							<input type="submit" name="Submit" value="Pass" style="height:40px; width:400px;">
  						 </form>
                        </td>
  					</tr>
				</table>
        	</td>
        </tr>
  </table>
</div>
</body>
</html>

dan di bawah in adalah coding untuk fungsi inputnya:

<?php
$open = mysql_connect ("localhost","root","");
mysql_select_db("db_ads1",$open) or die ("Koneksi gagal");

// file submit.php
// menangkap data yang dikirimkan dari file data_adsline.php mwnggunakan method = POST

$nik = $_POST['nik'];
$ncvs = $_POST['ncvs'];
$style = $_POST['style'];
//$kelas = $pilihan;
if(empty($nik) || empty($ncvs) || empty($style))
{
echo "Data harus lengkap
 <meta http-equiv='refresh' content='2' url= '../data_adsline.php'/> ";
}
else
{
$ncvs = $_POST['ncvs'];
$style = $_POST['style'];
//$kelas = $pilihan;

// perintah SQL
$query="INSERT INTO adsline VALUES ('$nik' ,' $ncvs','$style') " ;

$hasil=mysql_query($query);

if ($hasil){
//header ('location:data_adsline.php');
echo " <center> <b> <font color = 'red' size = '4'> <p> Data Berhasil disimpan </p> </center> </b> </font> <br/>
 <meta http-equiv='refresh' content='2' url= '../data_adsline.php'/>  ";
}
else { echo "Data gagal disimpan
 <meta http-equiv='refresh' content='2' url= '../data_adsline.php'/> ";
}
}
?>

avatar Chorong
@Chorong

2 Kontribusi 0 Poin

Diperbarui 6 tahun yang lalu

4 Jawaban:

diinput text fieldnya dikeluarin gan datanya, jadi gini simpelnya :


<?php

//Include kan file koneksi
include_once 'koneksi.php';

//Membuat query untuk mengeluarkan data dari database
$sql = mysql_query("SELECT * FROM nama_table WHERE kondisi bla bla ");
$data = mysql_fetch_array($sql);

?>

<form action="" method="post">
	<input type="text" name="name" value="<?php echo $data['nama_kolom_database']; ?>">
</form>

tinggal di sesuain aja,

nah itu buat ngeluarin data dari databasenya gan

avatar ahanafi
@ahanafi

815 Kontribusi 554 Poin

Dipost 8 tahun yang lalu

@ahmadhanaf Permisi mas, saya mempunyai masalah seperti yang diatas, tetapi dalam kasus saya, saya ingin mengambil data dari banyak table, itu kodingan nya seperti apa ya mas, mohon pencerahan nya

avatar Riahkora
@Riahkora

1 Kontribusi 0 Poin

Dipost 7 tahun yang lalu

Hi! @Riahkora pake JOIN aja mba,


$sql = mysqli_query($link, "SELECT * FROM table1 JOIN table2 ON condition WHERE bla bla.. ");

avatar ahanafi
@ahanafi

815 Kontribusi 554 Poin

Dipost 7 tahun yang lalu

kalo nampilin data yang diinput tapi beda form gimana ?

avatar dearamadiani
@dearamadiani

4 Kontribusi 0 Poin

Dipost 6 tahun yang lalu

Login untuk ikut Jawaban