 |
|
|
 |
 |
|
ใน checkbox value=ไอดี ส่วนหน้าที่รับค่าก็ใช้หลักการวนลูปเรียกไอดีมาครับ
|
 |
 |
 |
 |
Date :
2014-08-06 10:04:34 |
By :
Dragons_first |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใน value="<?=$show['id'];?> นี้หรอครับ
แล้วอีกหน้า ผมใช้ <?=$show['id'];?> วนรับค่าใช้ป่าวครับบบ
|
 |
 |
 |
 |
Date :
2014-08-06 10:11:55 |
By :
bbb |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตามคุณ Dragons_first ครับ <INPUT TYPE="CHECKBOX" NAME="ID[]" VALUE="<?=$ID?>" />
ส่วนการคิวรี่ นำมาแสดงใน php ตัวรับ
Code (PHP)
$inTxt=implode(',', $_REQUEST['ID']);
$qr="SELECT * FROM TABLE1 WHERE ID IN ( $inTxt )";
|
ประวัติการแก้ไข 2014-08-06 10:15:03
 |
 |
 |
 |
Date :
2014-08-06 10:13:49 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

ภาพนี้ เวลา รันออกมา เกิดerrorครับบ ช่วยทีนะคร้าบบผม ขอบคุนครับบบ
Code ส่วนที่จะใช่แสดงโชว์ค่าจาก Checkboxครับ
<?php
include_once"connect.php";
$inTxt=implode(',',$_REQUEST['ID']);
$sql="SELECT * FROM stock WHERE ID IN ( $inTxt )";
$rs=mysql_query($sql)
?>
<table id="mytable" border="1" align="center" width="1280" class="fix" >
<tr >
<td align="center" ><font color="#CCCCCC" size="+1">No.</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Product P/N</font></td>
<td align="center"><font color="#CCCCCC" size="+1"><p>Product Description</p>
</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Start</font></td>
<td align="center"><font color="#CCCCCC" size="+1">End</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Details</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Serial</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Project</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Code</font></td>
</tr>
<tbody>
<?php
while($show=mysql_fetch_assoc($rs))
{
?>
<tr >
<td align="center" ><? echo ++$n ?></td>
<td width="200" ><?=$show['product_id'];?></td>
<td class="fix"><?=$show['product_des'];?></td>
<td width="180" align="center"><?=$show['start_date'];?></td>
<td width="180" align="center"><?=$show['end_date'];?></td>
<td width="800"><?=$show['detail'];?> </td>
<td class="fix"><?=$show['serial'];?></td>
<td class="fix" ><a href="stock.php"><?=$show['project'];?></a></td>
<td width="25" align="center"><?=$show['trans_code'];?></td>
</tr><? }?>
</tbody>
</table>
|
 |
 |
 |
 |
Date :
2014-08-06 10:46:36 |
By :
bbb |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โห!!! เอาโค๊ดผมไปใช้ทั้งดุ้นไม่แก้ไขเลยนะครับ
<?php
include_once"connect.php";
$inTxt=implode(',',$_REQUEST['ID']);
$sql="SELECT * FROM stock WHERE ID IN ( $inTxt )";
$rs=mysql_query($sql)
?>
แก้เป็น
Code (PHP)
<?php
include_once"connect.php";
$inTxt=implode(',',$_REQUEST['ID']);
$sql="SELECT * FROM stock WHERE id IN ( $inTxt )"; // field ID มันไม่มีใน table ของคุณนะครับ
$rs=mysql_query($sql)
?>
|
ประวัติการแก้ไข 2014-08-06 10:56:14
 |
 |
 |
 |
Date :
2014-08-06 10:55:34 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
include_once"connect.php";
$sql="SELECT * FROM stock ";
$rs=mysql_query($sql)
?>
<form action="?" name="check" method="post" > <table id="mytable" border="1" align="center" width="1280" class="fix" >
<tr >
<td align="center" ><font color="#CCCCCC" size="+1">No.</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Product P/N</font></td>
<td align="center"><font color="#CCCCCC" size="+1"><p>Product Description</p>
</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Start</font></td>
<td align="center"><font color="#CCCCCC" size="+1">End</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Details</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Serial</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Project</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Code</font></td>
<td align="center" ><font color="#CCCCCC" size="+1">Image</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Edit</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Delete</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Export</font></td>
</tr>
<tbody>
<?php
while($show=mysql_fetch_assoc($rs))
{
?>
<tr >
<td align="center" ><? echo ++$n ?></td>
<td width="200" ><?=$show['product_id'];?></td>
<td class="fix"><?=$show['product_des'];?></td>
<td width="180" align="center"><?=$show['start_date'];?></td>
<td width="180" align="center"><?=$show['end_date'];?></td>
<td width="800"><?=$show['detail'];?> </td>
<td class="fix"><?=$show['serial'];?></td>
<td class="fix" ><a href="stock.php"><?=$show['project'];?></a></td>
<td width="25" align="center"><?=$show['trans_code'];?></td>
<td ><a href="../myproject/storeimage/<?=$show['image'];?>"><center><img src='<?=$show['image'];?>' /></center></a></td>
<td title="Edit" ><a href="stock.php?id=<?=$show['id'];?>"><img src="images/home/edit2.png" /></a></td>
<td align="center" title="Delete" ><a href="stock_delete.php?id=<?=$show['id'];?>" onclick="return confirm('ยืนยันการลบ')"><img src="images/home/dele.gif" /></a></td>
<td align="center" title="Export"> <a href="preson.php?id=<?=$show['id'];?>"> <input type="checkbox" name="check[]" id="check[]" value="<?=$show['id'];?>" /></a></td>
</tr> <? }?>
<input input type="submit" name="submit" value="ตรวจสอบ" onclick="<?=$show['id'];?>" /><input type="hidden" name="id" value="<?=$show['id'];?>" />
</table></form>
<table>
<table id="mytable" border="1" align="center" width="1280" class="fix" >
<tr >
<td align="center" ><font color="#CCCCCC" size="+1">No.</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Product P/N</font></td>
<td align="center"><font color="#CCCCCC" size="+1"><p>Product Description</p>
</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Start</font></td>
<td align="center"><font color="#CCCCCC" size="+1">End</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Details</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Serial</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Project</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Code</font></td>
<td align="center" ><font color="#CCCCCC" size="+1">Image</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Edit</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Delete</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Export</font></td>
</tr>
<tbody>
<?php
$id=$_POST['id'];
for($i=0;$i<count($id);$i++){
$select=mysql_query("SELECT * FROM stock WHERE id='".$id[$i]."'") or die (mysql_error());
$show=mysql_fetch_array($select);
?>
<tr >
<td align="center" ><? echo ++$n ?></td>
<td width="200" ><?=$show['product_id'];?></td>
<td class="fix"><?=$show['product_des'];?></td>
<td width="180" align="center"><?=$show['start_date'];?></td>
<td width="180" align="center"><?=$show['end_date'];?></td>
<td width="800"><?=$show['detail'];?> </td>
<td class="fix"><?=$show['serial'];?></td>
<td class="fix" ><a href="stock.php"><?=$show['project'];?></a></td>
<td width="25" align="center"><?=$show['trans_code'];?></td>
<td ><a href="../myproject/storeimage/<?=$show['image'];?>"><center><img src='<?=$show['image'];?>' /></center></a></td>
<td title="Edit" ><a href="stock.php?id=<?=$show['id'];?>"><img src="images/home/edit2.png" /></a></td>
<td align="center" title="Delete" ><a href="stock_delete.php?id=<?=$show['id'];?>" onclick="return confirm('ยืนยันการลบ')"><img src="images/home/dele.gif" /></a></td>
<td align="center" title="Export"> <a href="preson.php?id=<?=$show['id'];?>"> <input type="checkbox" name="check[]" id="check[]" value="<?=$show['id'];?>" /></a></td>
</tr> <? }?>
</table>
แนะนำ
1. ควรเขียน code ให้เป็นระเบียบมากว่านี้
2. $_REQUEST ควรที่จะเลิกใช้ ควรใช้ POST,GET แทน
|
ประวัติการแก้ไข 2014-08-06 11:06:11
 |
 |
 |
 |
Date :
2014-08-06 11:03:17 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แล้วครับบบ

ภาพนี้ เวลากด เลือก chackbox 5แถว แล้วกดปุ่ม มันไปแสดง หน้า preson.php
Code หน้า Show
<?php
include_once"connect.php";
$sql="SELECT * FROM stock ";
$rs=mysql_query($sql)
?>
<form action="preson.php" name="check" method="post" > <table id="mytable" border="1" align="center" width="1280" class="fix" >
<tr >
<td align="center" ><font color="#CCCCCC" size="+1">No.</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Product P/N</font></td>
<td align="center"><font color="#CCCCCC" size="+1"><p>Product Description</p>
</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Start</font></td>
<td align="center"><font color="#CCCCCC" size="+1">End</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Details</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Serial</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Project</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Code</font></td>
<td align="center" ><font color="#CCCCCC" size="+1">Image</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Edit</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Delete</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Export</font></td>
</tr>
<tbody>
<?php
while($show=mysql_fetch_assoc($rs))
{
?>
<tr >
<td align="center" ><? echo ++$n ?></td>
<td width="200" ><?=$show['product_id'];?></td>
<td class="fix"><?=$show['product_des'];?></td>
<td width="180" align="center"><?=$show['start_date'];?></td>
<td width="180" align="center"><?=$show['end_date'];?></td>
<td width="800"><?=$show['detail'];?> </td>
<td class="fix"><?=$show['serial'];?></td>
<td class="fix" ><a href="stock.php"><?=$show['project'];?></a></td>
<td width="25" align="center"><?=$show['trans_code'];?></td>
<td ><a href="../myproject/storeimage/<?=$show['image'];?>"><center><img src='<?=$show['image'];?>' /></center></a></td>
<td title="Edit" ><a href="stock.php?id=<?=$show['id'];?>"><img src="images/home/edit2.png" /></a></td>
<td align="center" title="Delete" ><a href="stock_delete.php?id=<?=$show['id'];?>" onclick="return confirm('ยืนยันการลบ')"><img src="images/home/dele.gif" /></a></td>
<td align="center" title="Export"> <a href="preson.php?id=<?=$show['id'];?>"> <input type="checkbox" name="ID[]" value="<?=$show['id'];?>" /></a></td>
</tr> <? }?>
<input input type="submit" name="submit" value="ตรวจสอบ" onclick="<?=$show['id'];?>" /><input type="hidden" name="id" value="<?=$show['id'];?>" />
</table></form>
ส่วนถ้าผมรัน จากหน้า person.php เลย
มัน แสดง 
อยากรู้ว่ามันจะแก้ยังไงให้เห็น แถวที่เราเลือกไปอ่ะครับ
ขอบคุณ คุณ Chaidhanan และคุณ Dragons_first เป็นอย่างสูงเลยนะคร้าบบบบ
|
ประวัติการแก้ไข 2014-08-06 11:17:32
 |
 |
 |
 |
Date :
2014-08-06 11:16:30 |
By :
bbb |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณ คุณ Ex-[S]i[L]e[N]t ด้วยนะครับ ทุกความคิดเห็น ผมจะนำกลับไปปรับปรุง แก้ไขนะครับ ขอบคุนที่ให้คำชี้แนะครับ
|
 |
 |
 |
 |
Date :
2014-08-06 14:57:29 |
By :
bbb |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
   
ร้ายจังคุณ
|
 |
 |
 |
 |
Date :
2014-08-06 16:43:45 |
By :
meanrascal |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำ code ตามที่บอกครับ พอกด checkbox แล้ว มันแสดง แค่นี้ครับบ
นี้เปนหน้ารับค่าครับบ
<?php
include_once"connect.php";
$sql="SELECT * FROM stock ";
$rs=mysql_query($sql)
?>
<form action="preson.php" name="check[]" method="post" > <table id="mytable" border="1" align="center" width="1280" class="fix" >
<tr >
<td align="center" ><font color="#CCCCCC" size="+1">No.</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Product P/N</font></td>
<td align="center"><font color="#CCCCCC" size="+1"><p>Product Description</p>
</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Start</font></td>
<td align="center"><font color="#CCCCCC" size="+1">End</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Details</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Serial</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Project</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Code</font></td>
<td align="center" ><font color="#CCCCCC" size="+1">Image</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Edit</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Delete</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Export</font></td>
</tr>
<tbody>
<?php
while($show=mysql_fetch_assoc($rs))
{
?>
<tr >
<td align="center" ><? echo ++$n ?></td>
<td width="200" ><?=$show['product_id'];?></td>
<td class="fix"><?=$show['product_des'];?></td>
<td width="180" align="center"><?=$show['start_date'];?></td>
<td width="180" align="center"><?=$show['end_date'];?></td>
<td width="800"><?=$show['detail'];?> </td>
<td class="fix"><?=$show['serial'];?></td>
<td class="fix" ><a href="stock.php"><?=$show['project'];?></a></td>
<td width="25" align="center"><?=$show['trans_code'];?></td>
<td ><a href="../myproject/storeimage/<?=$show['image'];?>"><center><img src='<?=$show['image'];?>' /></center></a></td>
<td title="Edit" ><a href="stock.php?id=<?=$show['id'];?>"><img src="images/home/edit2.png" /></a></td>
<td align="center" title="Delete" ><a href="stock_delete.php?id=<?=$show['id'];?>" onclick="return confirm('ยืนยันการลบ')"><img src="images/home/dele.gif" /></a></td>
<td align="center" title="Export"> <a href="preson.php?id=<?=$show['id'];?>"> <input type="checkbox" name="check[]" id="check[]" value="<?=$show['id'];?>" /></a></td>
</tr> <? }?>
<input input type="submit" name="submit" value="ตรวจสอบ" onclick="<?=$show['id'];?>" /><input type="hidden" name="id" value="<?=$show['id'];?>" />
</table></form>
Output แถวที่เลือก คับ

<table id="mytable" border="1" align="center" width="1280" class="fix" >
<tr >
<td align="center" ><font color="#CCCCCC" size="+1">No.</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Product P/N</font></td>
<td align="center"><font color="#CCCCCC" size="+1"><p>Product Description</p>
</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Start</font></td>
<td align="center"><font color="#CCCCCC" size="+1">End</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Details</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Serial</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Project</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Code</font></td>
<td align="center" ><font color="#CCCCCC" size="+1">Image</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Edit</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Delete</font></td>
</tr>
<tbody>
<?php
include_once"connect.php";
$id=$_POST['id'];
for($i=0;$i<count($id);$i++){
$select=mysql_query("SELECT * FROM stock WHERE id ='".$id[$i]."'") or die (mysql_error());
$show=mysql_fetch_array($select);
?>
<tr >
<td align="center" ><? echo ++$n ?></td>
<td width="200" ><?=$show['product_id'];?></td>
<td class="fix"><?=$show['product_des'];?></td>
<td width="180" align="center"><?=$show['start_date'];?></td>
<td width="180" align="center"><?=$show['end_date'];?></td>
<td width="800"><?=$show['detail'];?> </td>
<td class="fix"><?=$show['serial'];?></td>
<td class="fix" ><a href="stock.php"><?=$show['project'];?></a></td>
<td width="25" align="center"><?=$show['trans_code'];?></td>
<td ><a href="../myproject/storeimage/<?=$show['image'];?>"><center><img src='<?=$show['image'];?>' /></center></a></td>
<td title="Edit" ><a href="stock.php?id=<?=$show['id'];?>"><img src="images/home/edit2.png" /></a></td>
<td align="center" title="Delete" ><a href="stock_delete.php?id=<?=$show['id'];?>" onclick="return confirm('ยืนยันการลบ')"><img src="images/home/dele.gif" /></a></td>
</tr> <? }?>
</table>
นี้เป็นcode หน้าแสดงค่าที่ส่งไปครับ
Output ตามนี้

|
ประวัติการแก้ไข 2014-08-06 17:22:19
 |
 |
 |
 |
Date :
2014-08-06 17:17:33 |
By :
bbb |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<td align="center" title="Export"> <a href="preson.php?id=<?=$show['id'];?>"> <input type="checkbox" name="id[]" value="<?=$show['id'];?>" /></a></td>
ลองเปลี่ยน บรรทัด checkbox เป็นตัวนี้ตัวดูครับ
อธิบาย
<input type="checkbox" name="id[]" value="<?=$show['id'];?>" /> name="id[]" คืออะไร attr ในการเก็บเป็นรูปแบบ array ถ้า checked แล้วจะอยู่ใน array ที่เป็น name[1,2,3,4,5]
ทำยังให้ถึงแตก array ได้ก็คือการใช้ for
for($i=0;$i<count($id);$i++){} count คืออะไร คือการนับ array ที่มี ถ้าเข้าเงื่อนไขfor เราจะได้ตำแหน่ง $i ของ array ที่มีอยู่แล้วนำมา select
|
ประวัติการแก้ไข 2014-08-06 17:49:06
 |
 |
 |
 |
Date :
2014-08-06 17:39:43 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<table id="mytable" border="1" align="center" width="1280" class="fix" >
<tr >
<td align="center" ><font color="#CCCCCC" size="+1">No.</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Product P/N</font></td>
<td align="center"><font color="#CCCCCC" size="+1"><p>Product Description</p>
</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Start</font></td>
<td align="center"><font color="#CCCCCC" size="+1">End</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Details</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Serial</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Project</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Transaction Code</font></td>
<td align="center" ><font color="#CCCCCC" size="+1">Image</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Edit</font></td>
<td align="center"><font color="#CCCCCC" size="+1">Delete</font></td>
</tr>
<?php
include_once"connect.php";
$inTxt=implode(',',$_REQUEST['ID']);
$sql="SELECT * FROM stock WHERE id IN ( $inTxt )";
$rs=mysql_query($sql);
while( $show=mysql_fetch_assoc($rs)){
echo '<tr >
<td align="center" >'.(++$n).'</td>
<td width="200" >'. $show['product_id'].'</td>
<td class="fix">'. $show['product_des'].'</td>
<td width="180" align="center">'. $show['start_date']. '</td>
<td width="180" align="center">'. $show['end_date']. '</td>
<td width="800">'. $show['detail']. '</td>
<td class="fix">'. $show['serial']. '</td>
<td class="fix" ><a href="stock.php">'. $show['project']. '</a></td>
<td width="25" align="center">'. $show['trans_code']. '</td>
<td ><a href="../myproject/storeimage/'. $show['image']. '"><center><img src="'. $show['image']. '" /></center></a></td>
<td title="Edit" ><a href="stock.php?id='. $show['id']. '"><img src="images/home/edit2.png" /></a></td>
<td align="center" title="Delete" >
<a href="stock_delete.php?id='. $show['id']. '" onclick="return confirm(\'ยืนยันการลบ\')"><img src="images/home/dele.gif" /></a></td></tr>';
}
?>
</table>
ลองดูครับ ยังไม่ได้ทดสอบครับ (ไม่ได้สร้าง ตารางเพื่อทดสอบ)
ปล. คำสั่ง $_REQUEST เป็นการอ้างอิงตัวแปรโดยไม่ได้สนใจ ลักษณะการส่งข้อมูลเข้ามาว่าเป็นแบบไหน
ซึ่่งไม่ว่าจะเป็นคำสั่ง $_POST $_GET ผมยังไม่เห็นข้อแตกต่างในการใช้งาน หรือ ความแตกต่างในด้านความปลอดภัย
ซึ่งถ้าพูดถึงความปลอดภัย ควร ใช้ ระบบ session ในการควบคุณความปลอดภัย และการตรวจสอบตัวแปร ก่อนใช้งานมากว่า
ซึ่งในระดับการเรียนรู้ลักษณะการเขียนเพื่อความปลอดภัย คงไม่มีใครเขียน และเรียกใช้ตัวแปรตรงๆ กันแบบนี้หรอกครับ
เพราะ แค่ใช้ทูลของ firefox chrome เพื่อตรวจสอบลักษณะการส่งตัวแปร ก็ทำได้อย่างง่ายๆ แล้วล่ะครับ
|
ประวัติการแก้ไข 2014-08-06 18:16:45
 |
 |
 |
 |
Date :
2014-08-06 18:16:08 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$_POST $_GET $_REQUEST ไม่มีข้อแตกต่างกันครับ แต่แตกต่างในแง่ ความเข้าใจ
ถ้า Learner เขียนมากกว่า 5 หรือ 10 page สามารถรู้ได้ว่า $_POST $_GET ค่ามากจากส่วนไหน form หรือ url จะได้ไม่สับสน 
|
 |
 |
 |
 |
Date :
2014-08-06 18:25:04 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขึ้นแล้วครับ
ผมลองใส่ อาเรย์ ตรง <input type="hidden" name="id[]" value="<?=$show['id'];?>" />
แต่ว่าเวลาดึงไป ผมcheckbox ไป 2 แถว แต่ มันเกินมาแถว นึง แถวที่3 ครับ
ตามนี้อ่ะครับ
ขอบคุนทุกท่านอีกครั้งนะครับที่ช่วยและชี้แนะผม ขอบคุนมากๆเลยครับ
|
 |
 |
 |
 |
Date :
2014-08-06 19:08:44 |
By :
bbb |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้ แก้ไข้ ได้เรียนร้อย สมบูรณ์แล้วนะครับ
ขอบพระคุณทุกคนอีกครั้งนะครับ
แค่ ลบ <input type="hidden" name="id[]" value="<?=$show['id'];?>" />
|
 |
 |
 |
 |
Date :
2014-08-06 20:33:23 |
By :
bbb |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|