|
|
|
อยากทราบโค้ดที่วนกลับมารับค่าใหม่โดยรหัสยังเป็นรหัสเดิม |
|
|
|
|
|
|
|
ช่วยหน่อยคะ อยากทราบว่าจะวนกลับมารับค่าเพิ่มโดยที่รหัสรายละเอียดเป็นรหัสเดิมยังไงคะ
supplier_in.php
Code (PHP)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Supplier</title>
<!-- =================================================================================================================== -->
<link rel="stylesheet" type="text/css" href="../scsticker/css/formstyle.css"/>
<link rel="stylesheet" href="../scsticker/css/buttons.css">
<script type="text/javascript" src="../buttons/js/buttons.js"></script>
<script src="../scsticker/js/jquery-1.10.1.min.js"></script>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link href="../scsticker/css/customize-template.css" type="text/css" media="screen, projection" rel="stylesheet"/>
<link rel="stylesheet" href="assets/css/styles.css"/>
<link rel="stylesheet" href="../scsticker/css/fonts_googleapis.css"/>
<!-- =================================================================================================================== -->
<link rel="stylesheet" href="../scsticker/css/styles3.css">
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="../scsticker/css/script3.js"></script>
<!-- ======================================== -->
<style type="text/css">
body {background-color:#97afa5}
h1 {background-color: #00ff00}
h2 {background-color: transparent}
/*p {background-color: rgb(250,0,255)}
*/</style>
</head>
<body>
<h4>
<!-- ========== -->
<!-- connect -->
<?php
include("connect.php");
$db = "scsticker";
$result = mysql_select_db($db);
if(!$result){
die('Could not find database called supplier: '. mysql_error());
}
$sup_id = $_POST["sup_id"];
$sup_name = $_POST["sup_name"];
$sup_address = $_POST["sup_address"];
$agen_name = $_POST["agen_name"];
$sup_tel = $_POST["sup_tel"];
$sup_fax= $_POST["sup_fax"];
$sup_email= $_POST["sup_email"];
$test_id = "select sup_id from supplier where sup_id ='".$sup_id."'";
$tmp = mysql_query($test_id);
$rows = mysql_num_rows($tmp);
if($rows > 0){
echo "<br/>";
echo "<br/>";
echo "<section class='page container'>";
echo "<div class='row'>";
echo "<div class='span16'>";
echo "<div class='box'>";
echo "<a href='index.php' class='button button-rounded button-flat'>หน้าหลัก</a>";
echo "<a href='supplier.php' class='button button-rounded button-flat'>ข้อมูลบริษัทตัวแทนจำหน่าย</a>";
echo "<div class='box-header'>";
echo "<i class='icon-bookmark' align='left'></i>";
echo "<h5>เพิ่มข้อมูลบริษัทตัวแทนจำหน่าย</h5>";
echo "</div><br/>";
echo "<div class='box-content'>";
echo "<center> <div class='btn-group-box'> ";
echo "<div class='col-lg-6'>";
echo "<h2></h2>";
echo "<div class='table-responsive'>";
echo "<center>";
echo "ไม่สามารถเพิ่มข้อมูลได้มีรหัสบริษัทตัวแทนจำหน่ายนี้อยู่ในระบบแล้ว<br><br>";
echo "<script>location='supplier_form_insert.php?id=$sup_id';</script>";
exit;
}else{
$sql = "insert into `scsticker`.`supplier` (`sup_id`, `sup_name`, `sup_address`, `agen_name`, `sup_tel`, `sup_fax`, `sup_email`)
values ('".$sup_id."', '".$sup_name."', '".$sup_address."', '".$agen_name."', '".$sup_tel."', '".$sup_fax."', '".$sup_email."')";
$result = mysql_query($sql);
if(!$result){
die('Insert not success !!!: '. mysql_error());
}
}
?>
<!-- connect -->
<?php
include("connect.php");
$db = "scsticker";
$result = mysql_select_db($db);
if(!$result){
die('Could not find database called detailsupplier: '. mysql_error());
}
$detailsup_id = $_POST["detailsup_id"];
$sup_id = $_POST["sup_name"];
$mat_id = $_POST["mat_name"];
$price_to_unit = $_POST["price_to_unit"];
$test_id = "select detailsup_id from detail_supplier where detailsup_id ='".$detailsup_id."'";
$tmp = mysql_query($test_id);
$rows = mysql_num_rows($tmp);
if($rows > 0){
echo "<br/>";
echo "<br/>";
echo "<section class='page container'>";
echo "<div class='row'>";
echo "<div class='span16'>";
echo "<div class='box'>";
echo "<a href='index.php' class='button button-rounded button-flat'>หน้าหลัก</a>";
echo "<a href='detail_supplier.php' class='button button-rounded button-flat'>รายละเอียดบริษัทตัวแทนจำหน่าย</a>";
echo "<div class='box-header'>";
echo "<i class='icon-bookmark' align='left'></i>";
echo "<h5>เพิ่มข้อมูลรายละเอียดบริษัทตัวแทนจำหน่าย</h5>";
echo "</div><br/>";
echo "<div class='box-content'>";
echo "<center> <div class='btn-group-box'> ";
echo "<div class='col-lg-6'>";
echo "<h2></h2>";
echo "<div class='table-responsive'>";
echo "<center>";
echo "ไม่สามารถเพิ่มข้อมูลได้มีรหัสรายละเอียดบริษัทตัวแทนจำหน่ายนี้อยู่ในระบบแล้ว<br><br>";
echo "<script>location='supplier_form_insert.php?id=$detailsup_id';</script>";
exit;
}else{
$sql = "INSERT INTO `scsticker`.`detail_supplier`(`detailsup_id`, `sup_id`, `mat_id`, `price_to_unit`) VALUES
('".$detailsup_id."', '".$sup_id."', '".$mat_id."', '".$price_to_unit."')";
$result = mysql_query($sql);
if(!$result){
die('Insert not success !!!: '. mysql_error());
}
}
?>
</h4></center>
<script>
location="supplier.php";
</script>
</body>
</html>
Tag : PHP
|
ประวัติการแก้ไข 2015-11-25 09:11:56
|
|
|
|
|
Date :
2015-11-25 01:43:15 |
By :
POMP |
View :
697 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133.location="supplier.php?retVar=retValue";
ส่งค่ากลับไปด้วยสีแดงครับ เรียกโปรแกรมแค่นั้นมันก็ไม่รู้อะไรหรอกครับ
|
|
|
|
|
Date :
2015-11-25 09:16:17 |
By :
NewbiePHP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|