|
|
|
ทำไมฟอร์มส่งค่าเลข3 หลักหรือ 2 หลักมาแค่ตัวเลขหลักหน้าหลักเดียวครับ |
|
|
|
|
|
|
|
จากโค๊ดฟอร์มส่ง รับค่า SEQ มาจากอีกฟอร์ม แสดงใน text Asset_ID
Code (PHP)
$SEQ = null;
if(isset($_GET["Asset_ID"]))
{
$SEQ = $_GET["Asset_ID"];
}
?>
<center>
<p> </p>
<p>แบบคอมพิวเตอร์ </p></p>
<form action="save_add_user_repair.php" id="frmMain" name="frmMain" method="post">
<table width="580" cellspacing="0" cellpadding="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF" id="myTable2">
<!-- head table -->
<thead>
<tr>
<td width="98" height="26" align="right">Number : </td>
<td width="85" align="left"><input name="Asset_ID" type="text" id="Asset_ID" value="<?=$SEQ?>" size="3" readonly/> </td>
ส่งค่าไปเซฟใน
Code (PHP)
$SEQ = null;
if(isset($_POST["Asset_ID"]))
{
$SEQ = $_POST["Asset_ID"];
}
?>
<?php
ini_set('display_errors', 1);
error_reporting(~0);
error_reporting(0);
$serverName = "";
$userName = "root";
$userPassword = "";
$dbName = "";
$conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
mysqli_set_charset($conn, "utf8");
$User_name = $_REQUEST["User_name"];
$Branch_ID = $_REQUEST["Branch_ID"];
$Department_ID = $_REQUEST["Department_ID"];
$Telephone = $_REQUEST["Telephone"];
$Date_sent = $_REQUEST["Date_sent"];
$SEQ = $SEQ["Asset_ID"];
$Asset_re_detail = $_REQUEST["Asset_re_detail"];
//$Date_finish = $_REQUEST["Date_finish"];
echo $sql = "INSERT INTO user_repair(User_name, Branch_ID, Department_ID, Telephone, Date_sent, Asset_ID, Asset_re_detail, Date_finish)
VALUES('$User_name', '$Branch_ID', '$Department_ID', '$Telephone', '$Date_sent', '$SEQ', '$Asset_re_detail', '0000-00-00')";
$result = mysqli_query($conn, $sql) or die (" ข้อมูลผิดพลาด Error in query: $sql " . mysqli_error());
ค่า Asset ในฐานเป็น INTEGER ความยาว 7 ครับ
เช่นค่าที่แสดง 385 แต่พอบันทึก ได้แค่ค่า 3 ครัย
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2018-09-27 14:46:07 |
By :
sweerawat |
View :
623 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<input name="Asset_ID" type="text" id="Asset_ID" value="<?=$SEQ?>" size="3" readonly/>
size="3" // เอาออก
Code (PHP)
<input name="Asset_ID" type="text" id="Asset_ID" value="<?php echo $SEQ;?>" readonly/>
// <?php echo ?>
|
ประวัติการแก้ไข 2018-09-27 16:12:16
|
|
|
|
Date :
2018-09-27 15:55:52 |
By :
Hararock |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|