Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > อยากย้ายข้อมูลตาราง จาก ตาราง 1 ไปยังตาราง 2 ด้วยcheckbox แล้วกด submit อะครับ


[PHP] อยากย้ายข้อมูลตาราง จาก ตาราง 1 ไปยังตาราง 2 ด้วยcheckbox แล้วกด submit อะครับ

 
Topic : 116525



โพสกระทู้ ( 0 )
บทความ ( 0 )



สถานะออฟไลน์



ผมเพิ่งหัดเขียนน่ะครับ แล้วพยายามหาทางมา 2 วันแล้วยังไม่ค่อยเข้าใจ
อยากให้พี่ๆช่วยผมหน่อย พอจะมีโค้ดไหมคับ

อันนี้เป็นโคดจากหน้าฟอมแรกอะครับ แล้วผมอยากให้ข้อมูลที่โชในฟอมนี้ ย้ายไปอีกหน้านึงน่ะครับ

Code (PHP)
001.<?php require_once('../../Connections/Myconnect.php'); ?>
002.<?php
003.if (!function_exists("GetSQLValueString")) {
004.function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
005.{
006.  if (PHP_VERSION < 6) {
007.    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
008.  }
009. 
010.  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
011. 
012.  switch ($theType) {
013.    case "text":
014.      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
015.      break;   
016.    case "long":
017.    case "int":
018.      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
019.      break;
020.    case "double":
021.      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
022.      break;
023.    case "date":
024.      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
025.      break;
026.    case "defined":
027.      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
028.      break;
029.  }
030.  return $theValue;
031.}
032.}
033. 
034. 
035.mysql_select_db($database_Myconnect, $Myconnect);
036.mysql_query("SET NAMES UTF8");
037.$query_Recordset1 = "SELECT * FROM form_use_car";
038.$Recordset1 = mysql_query($query_Recordset1, $Myconnect) or die(mysql_error());
039.$row_Recordset1 = mysql_fetch_assoc($Recordset1);
040.$totalRows_Recordset1 = mysql_num_rows($Recordset1);
041.?>
042.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
043.<html xmlns="http://www.w3.org/1999/xhtml">
044.<head>
045.<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
046.<title>Untitled Document</title>
047.<style type="text/css">
048.body {
049.    background-attachment:fixed;
050.    background-color: #E6E6E6;
051.    color: #CCC;
052.}
053.</style>
054.<script type="text/javascript">
055.function MM_preloadImages() { //v3.0
056.  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
057.    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
058.    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
059.}
060.function MM_swapImgRestore() { //v3.0
061.  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
062.}
063.function MM_findObj(n, d) { //v4.01
064.  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
065.    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
066.  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
067.  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
068.  if(!x && d.getElementById) x=d.getElementById(n); return x;
069.}
070. 
071.function MM_swapImage() { //v3.0
072.  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
073.   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
074.}
075.</script>
076.</head>
077. 
078.<body >
079.<table width="1503" height="678" border="0" align="center" cellpadding="0" cellspacing="0">
080.<tr>
081.  <th width="1503" height="678" colspan="2" scope="row"><table width="1503" height="749" border="0" align="center" cellpadding="0" cellspacing="0">
082.    <tr align="center">
083.      <th height="400" colspan="8" align="center" valign="bottom" scope="col"><img src="../Photos/Admin_head .png" width="1500" height="400" /></th>
084.    </tr>
085.    <tr align="center" valign="top">
086.      <th width="150" height="50" bgcolor="#4F2F1F" scope="row"><a href="Report_Admin.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image11','','../Photos/bt_Ad_report(s).png',1)"><img src="../Photos/bt_Ad_report.png" name="Image11" width="150" height="50" border="0" id="Image11" /></a><br />      </th>
087.      <th width="301" bgcolor="#705347" scope="row"><a href="index_Admin.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','../Photos/bt_Ad_home(s).png',1)"><img src="../Photos/bt_Ad_home.png" name="Image3" width="300" height="50" border="0" id="Image3" /></a></th>
088.      <th width="301" bgcolor="#705347" scope="row"><a href="request_Admin.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','../Photos/bt_Ad_use(s).png',1)"><img src="../Photos/bt_Ad_use.png" name="Image4" width="300" height="50" border="0" id="Image4" /></a></th>
089.      <th width="301" bgcolor="#705347" scope="row"><a href="Statuscar1_Admin.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','../Photos/bt_Ad_statuscar(s).png',1)"><img src="../Photos/bt_Ad_statuscar.png" name="Image5" width="300" height="50" border="0" id="Image5" /></a></th>
090.      <th width="301" bgcolor="#705347" scope="row"><a href="Showemp_Admin.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','../Photos/bt_Ad_dataCus(s).png',1)"><img src="../Photos/bt_Ad_dataCus .png" name="Image6" width="300" height="50" border="0" id="Image6" /></a></th>
091.      <th colspan="3" align="left" bgcolor="#4F2F1F" scope="row"><a href="Return_Admin.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','../Photos/bt_Ad_return(s).png',1)"> <img src="../Photos/bt_Ad_return.png" name="Image10" width="150" height="50" border="0" id="Image10" /></a></th>
092.      </tr>
093.    <tr align="center" valign="top">
094.      <th height="51" colspan="8" align="center" bgcolor="#4F2F1F" scope="row"><p>&nbsp;</p>
095.        <p>คำขอใช้รถจาก usr ทุกคน</p>
096.        <p>&nbsp;</p>
097.        <form id="form1" name="form1" method="post" action="add.php">
098.          <table border="1">
099.            <tr>
100.              <td>&nbsp;</td>
101.              <td>ID_Order</td>
102.              <td>ID</td>
103.              <td>Name</td>
104.              <td>SName</td>
105.              <td>Department</td>
106.              <td>Part</td>
107.              <td>Email</td>
108.              <td>Phone</td>
109.              <td>Type_car</td>
110.              <td>Passenger</td>
111.              <td>Location</td>
112.              <td>Date_use_car</td>
113.              <td>Dateend_use_car</td>
114.              <td>Note_use_for</td>
115.              <td>option</td>
116.            </tr>
117.            <?php do { ?>
118.            <tr>
119.              <td><input type="checkbox" name="Check_1" id="Check_1" />
120.                <label for="Check_1"></label></td>
121.              <td><?php echo $row_Recordset1['ID_Order']; ?></td>
122.              <td><?php echo $row_Recordset1['ID']; ?></td>
123.              <td><?php echo $row_Recordset1['Name']; ?></td>
124.              <td><?php echo $row_Recordset1['SName']; ?></td>
125.              <td><?php echo $row_Recordset1['Department']; ?></td>
126.              <td><?php echo $row_Recordset1['Part']; ?></td>
127.              <td><?php echo $row_Recordset1['Email']; ?></td>
128.              <td><?php echo $row_Recordset1['Phone']; ?></td>
129.              <td><?php echo $row_Recordset1['Type_car']; ?></td>
130.              <td><?php echo $row_Recordset1['Passenger']; ?></td>
131.              <td><?php echo $row_Recordset1['Location']; ?></td>
132.              <td><?php echo $row_Recordset1['Date_use_car']; ?></td>
133.              <td><?php echo $row_Recordset1['Dateend_use_car']; ?></td>
134.              <td><?php echo $row_Recordset1['Note_use_for']; ?></td>
135.              <td>&nbsp;</td>
136.            </tr>
137.            <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
138.          </table>
139.          <p>&nbsp;            </p>
140.          <p>
141.            <input type="submit" name="btn_go" id="btn_go" value="Submit" />
142.          </p>
143.        </form>
144.       
145.        <p>&nbsp;</p>
146.        <p>&nbsp;</p></th>
147.      </tr>
148.    <tr>
149.      <th height="20" colspan="8" bgcolor="#705347" scope="row"><img src="../Photos/Admin_lower.png" width="1500" height="200" /></th>
150.    </tr>
151.    <tr>
152.      <th height="48" colspan="8" valign="top" scope="row">&nbsp;</th>
153.    </tr>
154.  </table></th>
155.</tr>
156.</table>
157.<map name="Map" id="Map">
158.  <area shape="circle" coords="514,369,28" href="https://login.live.com/" target="_top" />
159.  <area shape="rect" coords="422,9,455,20" href="../index.html" />
160.  <area shape="circle" coords="443,368,27" href="https://www.facebook.com" />
161.  <area shape="circle" coords="586,367,28" href="https://www.youtube.com/" />
162.  <area shape="rect" coords="484,11,528,19" href="#" />
163.  <area shape="rect" coords="510,395,512,414" href="#" />
164.</map>
165. 
166.<map name="Map2" id="Map2">
167.  <area shape="rect" coords="485,60,745,81" href="https://www.facebook.com/ikkyu.kladthrong" />
168.</map>
169.</body>
170.</html>
171.<?php
172.mysql_free_result($Recordset1);
173.?>




Tag : MySQL

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-05-15 21:52:58 By : ikkyu View : 1205 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Code (form.php)
01.<html>
02.<head>
03.<title>ThaiCreate.Com PHP & MySQL Tutorial</title>
04.</head>
05.<body>
06.<script language="JavaScript">
07.    function onSave()
08.    {
09.        if(confirm('Do you want to save ?')==true)
10.        {
11.            return true;
12.        }
13.        else
14.        {
15.            return false;
16.        }
17.    }
18.</script>
19.<form name="frmMain" action="save.php" method="post" OnSubmit="return onSave();">
20.<?
21.$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
22.$objDB = mysql_select_db("mydatabase");
23.$strSQL = "SELECT * FROM customer";
24.$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
25.?>
26.<table width="600" border="1">
27.  <tr>
28.    <th width="91"> <div align="center">CustomerID </div></th>
29.    <th width="98"> <div align="center">Name </div></th>
30.    <th width="198"> <div align="center">Email </div></th>
31.    <th width="97"> <div align="center">CountryCode </div></th>
32.    <th width="59"> <div align="center">Budget </div></th>
33.    <th width="71"> <div align="center">Used </div></th>
34.    <th width="30"> <div align="center">Select </div></th>
35.  </tr>
36.<?
37.while($objResult = mysql_fetch_array($objQuery))
38.{
39.?>
40.  <tr>
41.    <td><div align="center"><?=$objResult["CustomerID"];?></div></td>
42.    <td><?=$objResult["Name"];?></td>
43.    <td><?=$objResult["Email"];?></td>
44.    <td><div align="center"><?=$objResult["CountryCode"];?></div></td>
45.    <td align="right"><?=$objResult["Budget"];?></td>
46.    <td align="right"><?=$objResult["Used"];?></td>
47.    <td align="center"><input type="checkbox" name="chkEmail[]" value="<?=$objResult["Email"];?>"></td>
48.  </tr>
49.<?
50.}
51.?>
52.</table>
53.<?
54.mysql_close($objConnect);
55.?>
56.<input type="submit" name="btnSave" value="Save">
57.</form>
58.</body>
59.</html>


Code (save.php)
01.<html>
02.<head>
03.<title>ThaiCreate.Com PHP & MySQL Tutorial</title>
04.</head>
05.<body>
06.<?
07.$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
08.$objDB = mysql_select_db("mydatabase");
09. 
10.    for($i=0;$i<count($_POST["chkEmail"]);$i++)
11.    {
12.        if($_POST["chkEmail"][$i] != "")
13.        {
14.            $strSQL = "INSERT INTO table_name (Mail) VALUES ('".$_POST["chkEmail"][$i]."')";
15.            $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");         
16.        }
17.    }
18. 
19.    echo "Record Insert.";
20. 
21.mysql_close($objConnect);
22.?>
23.</body>
24.</html>


Go to : PHP Multiple Checkbox
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-05-16 07:31:34 By : mr.win
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : อยากย้ายข้อมูลตาราง จาก ตาราง 1 ไปยังตาราง 2 ด้วยcheckbox แล้วกด submit อะครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่