|
|
|
ขอความช่วยเหลือหน่อยคะ เลือกข้อมูลจาก popup อยากจะเอารูปไปโชว์ที่ตารางต้องทำยังไงหรอคะ |
|
|
|
|
|
|
|
อยากจะทราบว่าจะเอารูปไปโชว์ในตารางที่แสดงข้อมูลยังไงหรอคะขอความช่วยเหลือหรือคำแนะนำหน่อยคะ
getMain1.php
<html>
<head>
<title>ThaiCreate.Com</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<?php
mysql_connect("localhost","root","");
mysql_select_db("scsticker");
?>
<script language="javascript">
function OpenPopup(intLine)
{
window.open('getData.php?Line='+intLine,'myPopup','width=650,height=200,toolbar=0, menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0');
}
</script>
<body>
<form name="frmMain" method="post" action="readData.php">
<table width="600" border="1">
<tr>
<td><div align="center">No </div></td>
<td><div align="center">CustomerID </div></td>
<td><div align="center">Name </div></td>
<td><div align="center">Email </div></td>
<td><div align="center">Country Code </div></td>
<td><div align="center">Budget </div></td>
<td><div align="center">Used </div></td>
<td><div align="center">Popup </div></td>
</tr>
<!-- Rows 1 -->
<tr>
<td><div align="center">1 </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtCustomerID_1" ID="txtCustomerID_1" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtName_1" ID="txtName_1" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtEmail_1" ID="txtEmail_1" VALUE=""></center> </div></td>
<td><div align="center"><center>
<SELECT NAME="txtCountryCode_1" ID="txtCountryCode_1" width="100px">
<OPTION VALUE=""></OPTION>
<?php
$strSQL = "SELECT * FROM unit";
mysql_query("SET NAMES UTF8");
$objQuery = mysql_query($strSQL);
while($objResult = mysql_fetch_array($objQuery))
{
?>
<OPTION VALUE="<?php echo $objResult["unit_id"];?>"><?php echo $objResult["unit_name"];?></OPTION>
<?php
}
?>
</SELECT></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtBudget_1" ID="txtBudget_1" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtUsed_1" ID="txtUsed_1" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="BUTTON" NAME="btnPopup_1" ID="btnPopup_1" VALUE="..." OnClick="OpenPopup(1)"></center> </div></td>
</tr>
<!-- Rows 2 -->
<tr>
<td><div align="center">2 </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtCustomerID_2" ID="txtCustomerID_2" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtName_2" ID="txtName_2" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtEmail_2" ID="txtEmail_2" VALUE=""></center> </div></td>
<td><div align="center"><center>
<SELECT NAME="txtCountryCode_2" ID="txtCountryCode_2">
<OPTION VALUE=""></OPTION>
<?php
$strSQL = "SELECT * FROM unit";
$objQuery = mysql_query($strSQL);
while($objResult = mysql_fetch_array($objQuery))
{
?>
<OPTION VALUE="<?php echo $objResult["unit_id"];?>"><?php echo $objResult["unit_name"];?></OPTION>
<?php
}
?>
</SELECT></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtBudget_2" ID="txtBudget_2" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtUsed_2" ID="txtUsed_2" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="BUTTON" NAME="btnPopup_2" ID="btnPopup_2" VALUE="..." OnClick="OpenPopup(2)"></center> </div></td>
</tr>
<!-- Rows 3 -->
<tr>
<td><div align="center">3 </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtCustomerID_3" ID="txtCustomerID_3" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtName_3" ID="txtName_3" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtEmail_3" ID="txtEmail_3" VALUE=""></center> </div></td>
<td><div align="center"><center>
<SELECT NAME="txtCountryCode_3" ID="txtCountryCode_3">
<OPTION VALUE=""></OPTION>
<?php
$strSQL = "SELECT * FROM unit";
$objQuery = mysql_query($strSQL);
while($objResult = mysql_fetch_array($objQuery))
{
?>
<OPTION VALUE="<?php echo $objResult["unit_id"];?>"><?php echo $objResult["unit_name"];?></OPTION>
<?php
}
?>
</SELECT></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtBudget_3" ID="txtBudget_3" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="TEXT" SIZE="5" NAME="txtUsed_3" ID="txtUsed_3" VALUE=""></center> </div></td>
<td><div align="center"><center><INPUT TYPE="BUTTON" NAME="btnPopup_3" ID="btnPopup_3" VALUE="..." OnClick="OpenPopup(3)"></center> </div></td>
</tr>
</table>
<input type="hidden" name="hdnMaxLine" value="3">
<input type="submit" name="btnSubmit" value="Submit">
</form>
</body>
</html>
getData.php
<html>
<head>
<title>ThaiCreate.Com</title>
<?php
@session_start();
include("connect.php");
mysql_query("SET NAMES UTF8");
$name = null;
$id=null;
if(isset($_SESSION['id'])) {
if ($_SESSION['status']=='customer') {
//หาชื่อลูกค้า
$sqlcustomer = "SELECT * FROM customer WHERE cus_username='".$_SESSION["username"]."'";
$objQuerycustomer = mysql_query($sqlcustomer);
$objResultcustomer = mysql_fetch_array($objQuerycustomer);
$id = $objResultcustomer["cus_id"];
$name=$objResultcustomer["cus_name"];
} else if ($_SESSION['status']=='admin' || $_SESSION['status']=='user') {
$sqlemployee = "SELECT * FROM employee WHERE emp_username='".$_SESSION["username"]."'";
$objQueryemployee = mysql_query($sqlemployee);
$objResultemployee = mysql_fetch_array($objQueryemployee);
$id = $objResultemployee["emp_id"];
$name=$objResultemployee["emp_name"];
}
}
?>
</head>
<script language="javascript">
function selData(intLine,CustomerID,Name,Email,CountryCode,Budget,Used)
{
var sCustomerID = self.opener.document.getElementById("txtCustomerID_" +intLine);
sCustomerID.value = CustomerID;
var sName = self.opener.document.getElementById("txtName_" +intLine);
sName.value = Name;
var sEmail = self.opener.document.getElementById("txtEmail_" +intLine);
sEmail.value = Email;
var sCountryCode = self.opener.document.getElementById("txtCountryCode_" +intLine);
sCountryCode.value = CountryCode;
var sBudget = self.opener.document.getElementById("txtBudget_" +intLine);
sBudget.value = Budget;
var sUsed = self.opener.document.getElementById("txtUsed_" +intLine);
sUsed.value = Used;
window.close();
}
</script>
<body>
<?php
$objConnect = mysql_connect("localhost","root","") or die("Error Connect to Database");
$objDB = mysql_select_db("scsticker");
$strSQL = "SELECT * FROM sale s,detail_saledesign ds,sale_detail sd,detail_file_picdesign df,unit u WHERE u.unit_id = ds.unit_id AND s.sale_id = ds.sale_id AND ds.detail_saledesign_id = sd.detail_saledesign_id AND sd.sale_detail_id=df.sale_detail_id AND df.confirm_status = 'ยืนยันรูปภาพ' AND s.typesale='saledesign' AND sd.comment='' AND s.cus_id='".$id."' ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">CustomerID </div></th>
<th width="98"> <div align="center">Name </div></th>
<th width="198"> <div align="center">Email </div></th>
<th width="97"> <div align="center">CountryCode </div></th>
<th width="59"> <div align="center">Budget </div></th>
<th width="71"> <div align="center">Used </div></th>
</tr>
<?php
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><a href="#" OnClick="selData('<?php echo $_GET["Line"];?>' ,'<?php echo $objResult["sale_id"];?>', '<?php echo $objResult["width"];?>','<?php echo $objResult["longs"];?>' ,'<?php echo $objResult["unit_id"];?>','<?php echo $objResult["detail_filepic_id"];?>' ,'<?php echo $objResult["cus_id"];?>');">
<?php echo $objResult["sale_id"];?>
</a></div></td>
<td><?php echo $objResult["width"];?></td>
<td><?php echo $objResult["longs"];?></td>
<td><div align="center"><?php echo $objResult["unit_name"];?></div></td>
<td align="right"><?php echo $objResult["detail_filepic_id"];?></td>
<td align="right">
<input type="text" name="addresspicture" id="addresspicture" value="../scsticker_test/img/detaildesign_img/<?=$objResult['detail_filepic_id']?>.jpg">
<img src="../scsticker_test/img/detaildesign_img/<?php echo $objResult['detail_filepic_id']?>.jpg" class="magnify" style="width:120px;height:120px;">
</td>
</tr>
<?php
}
?>
</table>
<?php
mysql_close($objConnect);
?>
</body>
</html>
Tag : PHP
|
ประวัติการแก้ไข 2016-12-22 13:05:57
|
|
|
|
|
Date :
2016-12-22 12:42:45 |
By :
POMP |
View :
841 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
บทความนี้ครับ
Passing Popup to Main Page เทคนิคการส่งค่าจาก Popup ไปยังหน้าเพจ
|
|
|
|
|
Date :
2016-12-22 18:14:25 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คือพวกข้อมูลที่เป็น type text อันนี้หนูเอามาจากpopup ได้คะ แต่ที่เอามาไม่ได้คือ รูปภาพคะเลยอยากทราบว่าทำยังไง
|
|
|
|
|
Date :
2016-12-22 20:08:48 |
By :
POMP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|