|
 |
|
รบกวนทีครับ มันบันทึกข้อมูลไม่ตรงหน้าที่ใส่โค้ดไว้ทั้ง ๆ ที่ไม่มีโค้ดบันทึกข้อมูลอยู่แต่มีอยู่อีกหน้า |
|
 |
|
|
 |
 |
|
คือมันจะบันทึกตั้งแต่หน้านี้(ตามรูป) เลยครับทั้ง ๆ ที่โค้ดบันทึกไม่มีอยู่ในหน้านี้เลย ผมเขียนไว้อีกหน้านึง(รูป 2)

Code (PHP)
<?php
if (isset($_POST["chkSel3"])){
echo "<div class='gagal'>
กำหนดค่าน้ำหนักข้อมูล <img src='mos-css/img/bullet1.png' width='14' height='14' alt=''/> ความสามารถของธุรกิจ <img src='mos-css/img/bullet1.png' width='14' height='14' alt=''/> ทรัพยากร
</div>
<table width='93%' class='data'>
<tr class='data'>
<th class='data'>ชื่อทรัพยากร</th>
<th class='data'>คำอธิบาย</th>
<th class='data'>ผลกระทบ</th>
<th class='data' >ความถี่</th>
</tr>";
foreach($_POST["chkSel3"] as $line){
$item = explode("|" , $line); // $item[0] , $item[1] ,.....
echo "<tr class='data'>",
"<input type='hidden' name='hdn_resID[]' value='{$item[0]}'>",
"<input type='hidden' name='hdn_restype[]' value='{$item[3]}'>",
"<input type='hidden' name='hdn_resdate[]' value='{$item[4]}'>",
"<td class='data'><input type='text' name='name_res3[]' value='{$item[1]}' style='border-style:none; background-color: transparent;'></td>",
"<td class='data'><input type='text' name='description3[]' value='{$item[2]}' style='border-style:none; background-color: transparent;' ></td>",
"<td class='data'>",
"<center>",
"<input type='text' name='txtNumberA3[]' class='num1' OnChange='fncSum();' size='3' maxlength='3' OnKeyPress='return chkNumber(this)' onKeyUp='checkNumber2(this);'>",
"</center>",
"</td>",
"<td class='data'>",
"<center>",
"<input type='text' name='txtNumberB3[]' class='num2' OnChange='fncSum();' size='3' maxlength='3' OnKeyPress='return chkNumber(this)' onKeyUp='checkNumber2(this);'>
<input type='text' name='summary3[]' class='result' size='2' style='border-style:none; background-color: transparent;' maxlength='3'>",
"</center>",
"</td>",
"</tr> \n";
}
}
?>
</table>

โค้ด หน้าที่ต้องการให้บันทึก
Code (PHP)
<?php
if(isset($_POST["txtNumberA3"] ,$_POST["txtNumberB3"])){
echo "<div class='gagal'>
กำหนดค่าน้ำหนักข้อมูล <img src='mos-css/img/bullet1.png' width='14' height='14' alt=''/> ความสามารถของธุรกิจ <img src='mos-css/img/bullet1.png' width='14' height='14' alt=''/> ทรัพยากร
</div>
<table width='93%' class='data'>
<tr class='data'>
<th class='data' width='22%'>ชื่อทรัพยากร</th>
<th class='data' width='67%'>คำอธิบาย</th>
<th class='data'>คะแนนรวม</th>
</tr>";
foreach($_POST["txtNumberA3"] as $key => $value){
$result = $value * $_POST["txtNumberB3"][$key];
if( $result > $_POST["score"]){
echo "<tr class='data'>",
"<input type='hidden' name='hdn_resID' value='{$_POST["hdn_resID"][$key]}'>",
"<input type='hidden' name='hdn_restype' value='{$_POST["hdn_restype"][$key]}'>",
"<input type='hidden' name='hdn_resdate' value='{$_POST["hdn_resdate"][$key]}'>",
"<td class='data'>{$_POST["name_res3"][$key]}</td>",
"<td class='data'>{$_POST["description3"][$key]}</td>",
"<td class='data'><center><a href='#' title='ผลกระทบ = $value <br>*<br> ความถี่ = {$_POST["txtNumberB3"][$key]}'>$result</a></center></td>",
"</tr> \n";
$strSQL3="INSERT INTO insert_resource(resource_id,name,description,resource_type,effect,frequency,insert_date,score)
VALUES('{$_POST[hdn_resID][$key]}','{$_POST[name_res3][$key]}','{$_POST[description3][$key]}','{$_POST[hdn_restype][$key]}','$value',{$_POST[txtNumberB3][$key]},'{$_POST[hdn_resdate][$key]}','$result')";
$objQuery3 = mysql_query($strSQL3) ;
}
}
}
?>
</table>
Tag : PHP, MySQL, HTML/CSS, JavaScript, Ajax, jQuery

|
|
 |
 |
 |
 |
Date :
2014-02-26 16:21:15 |
By :
littlebeer |
View :
766 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ดันหน่อย ๆ
|
 |
 |
 |
 |
Date :
2014-02-26 19:43:34 |
By :
littlebeer |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เพจฟอร์มรับข้อมูล ก่อนกดปุ่มตกลง ชื่ออะไร
จะส่งค่าไปบันทึกที่เพจไหน ชื่อว่าอะไร
ปัญหามันเกิดตั้งแต่เพจฟอร์มรับค่า หรือ เกิดปัญหาตรงไหน
ที่คุณโพสต์รูปมายังไม่เข้าใจ
|
 |
 |
 |
 |
Date :
2014-02-26 19:53:22 |
By :
apisitp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เพจฟอร์มรับข้อมูล ก่อนกดปุ่มตกลง = <form name ="Frm_weight" method="POST" action="Result.php" id="Frm_weight">
จะส่งค่าไปบันทึกที่เพจ = <form name ="Frm_result" method="POST" action="" >
ปัญหามันเกิดตั้งแต่เพจฟอร์มรับค่า คือกด submit ปุ๊บมันจะบันทึกลง DB ทันที(ปกติมันจะแค่เปลี่ยนไปอีกหน้าเฉย ๆ) ที่ต้องการคือให้มากดบันทึกที่เพจ Result.php
ที่เพจฟอร์มรับข้อมูลไม่มีโค้ดการบันทึกข้อมูลเลยครับ
|
 |
 |
 |
 |
Date :
2014-02-26 21:33:22 |
By :
littlebeer |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมอาจจะช่วยไม่ได้ทั้งหมด แต่ที่คิดได้คือ คุณต้องโพสต์ code ทั้ง 3 เพจของคุณครับ ที่นี้มันติดอะไร ใครผ่านมาอ่านจะช่วยแก้ไขได้...
อีกอย่างนะครับถ้าไม่มี code ติดต่อ database แน่ ๆ การบันทึกจะไม่เกิดแน่ ๆ
คุณมีการ link หรือ อินครูดไฟล์อะไรมาไว้ก่อนหน้า แล้วในไฟล์นั้น ๆ มีกระบวนการคิวรี่อยู่ก็เป็นไปได้ครับ
|
 |
 |
 |
 |
Date :
2014-02-27 09:07:02 |
By :
apisitp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แล้วหน้าเจ้ากรรม เจ้าปัญหาที่มันเกิดการบันทึกข้อมูลก่อนหน้าจริง คือ หน้าไหน code ไหน??
|
 |
 |
 |
 |
Date :
2014-02-27 17:23:42 |
By :
apisitp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|