|
|
|
ช่วยแนะนำโค้ดเกี่ยวกับการแก้ไขข้อมูลหน่อยนะค่ะ มันไม่แสดงข้อมูลก่อนการแก้ไข |
|
|
|
|
|
|
|
หน้านี้ เป็นหน้า edit.php
Code (PHP)
<?php
session_start();
if($_SESSION['UserID'] == "")
{
echo "Please Login!";
exit();
}
if($_SESSION['Status'] != "USER")
{
echo "This page for Admin only!";
exit();
}
mysql_connect("localhost","root","root");
mysql_select_db("equipment");
$strSQL = "SELECT * FROM member WHERE UserID = '".$_SESSION['UserID']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.menu {
color: #FFFFFF;
}
.right {
text-align: right;
}
.table {
font-weight: normal;
background-color: #E9AA56;
}
-->
</style>
</head>
<body>
<table width="100%" border="0">
<tr>
<td height="144"><img src="head.jpg" width="100%" height="145" /></td>
</tr>
</table>
<table width="30%" border="0" align="left" >
<tbody>
<tr>
<td width="34%">ยินดีต้อนรับ คุณ :</td>
<td width="66%"><b><?php echo $objResult["Name"]?></b></td>
</tr>
</tbody>
</table>
<?php
echo '<br><table width="100%" border="0" class="boder" align="left" height="400">';
echo '<tr><td align="center" valign="top"><br>';
form();
echo "</td></tr>";
echo "</table>";
function form() {
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("equipment");
$id=$_GET["id"];
$sql = "select * from equipment_store where equip_id ='".$id."' order by equip_id desc";
$result = mysql_query($sql);
$objResult = mysql_fetch_array($result)
?>
<form method="GET" name="frmMain" action="edit_action.php" enctype="multipart/form-data" OnSubmit="return chkSubmit();">
<script language="JavaScript">
function chkSubmit()
{
if(document.frmMain.serial_number.value=="")
{
alert('กรุณากรอกป็นตัวเลขเท่านั้น.');
document.frmMain.st_year.focus();
return false;
}
if(isNaN(document.frmMain.price.value))
{
alert('กรุณากรอกป็นตัวเลขเท่านั้น.');
document.frmMain.receive_year.focus();
return false;
}
if(document.frmMain.asset_number.value=="")
{
alert('กรุณากรอกป็นตัวเลขเท่านั้น.');
document.frmMain.co_id.focus();
return false;
}
}
</script>
<?php
$sql1 = "select * from equipment_store where equip_id ='".$id."' order by equip_id desc";
$result1 = mysql_query($sql1);
$objResult1 = mysql_fetch_array($result1)
?>
<?php echo "<br><br><table border='1' width='30%' align='center' bgcolor='#FFFF99' class='.right'>";
echo <<<HTMLBLOCK
<p align="center"><strong>แก้ไขรายละเอียดอุปกรณ์</strong></p>
<tr><td align="right" width="30%">Serial Number : </td><td align="left">$objResult1[serial_number]</td></tr>
<tr><td align="right" width="30%">Region : </td><td align="left"><select name='region'>
<option value='NOE' $objResult1[region] = "NOE"(selected = "selected")>NOE</option>
<option value='NOR' $objResult1[region] = "NOR"(selected = "selected")>NOR</option>
<option value='CWE' $objResult1[region] = "CWE"(selected = "selected")>CWE</option>
<option value='SOU' $objResult1[region] = "SOU"(selected = "selected")>SOU</option>
<option value='BKN' $objResult1[region] = "BKN"(selected = "selected")>BKN</option>
<option value='BKS' $objResult1[region] = "BKS"(selected = "selected")>BKS</option>
</select></td></tr>
<tr><td align="right" valign="top">Equipment : </td><td align="left"><select name='descript'>
<option value='INFRARED THERMOMETER' $objResult1[descript] = "INFRARED THERMOMETER"(selected = "selected")>INFRARED THERMOMETER</option>
<option value='Signal Generator' $objResult1[descript] = "Signal Generator"(selected = "selected")>Signal Generator</option>
<option value='Advanced Network Tester' $objResult1[descript] = "Advanced Network Tester"(selected = "selected")>Advanced Network Tester</option>
<option value='Digital Earth Tester' $objResult1[descript] = "Digital Earth Tester"(selected = "selected")>Digital Earth Tester</option>
<option value='Automatic Voltage Stabilizer' $objResult1[descript] = "Automatic Voltage Stabilizer"(selected = "selected")>Automatic Voltage Stabilizer</option>
<option value='Barcode Scanner' $objResult1[descript] = "Barcode Scanner"(selected = "selected")>Barcode Scanner</option>
</select></td></tr>
<tr><td align="right" valign="top">Brand : </td><td align="left"><select name='brand'>
<option value='FLUKE' $objResult1[brand] = "FLUKE"(selected = "selected")>FLUKE</option>
<option value='NEC' $objResult1[brand] = "NEC"(selected = "selected")>NEC</option>
<option value='ACTERNA' $objResult1[brand] = "ACTERNA"(selected = "selected")>ACTERNA</option>
<option value='CHAUVIN ARNOUX' $objResult1[brand] = "CHAUVIN ARNOUX"(selected = "selected")>CHAUVIN ARNOUX</option>
<option value='Stabilizer' $objResult1[brand] = "Stabilizer"(selected = "selected")>Stabilizer</option>
</select></td></tr>
<tr><td align="right">Model : </td><td align="left"><select name='model'>
<option value='62' $objResult1[model] = "62"(selected = "selected")>62</option>
<option value='2023B' $objResult1[model] = "2023B"(selected = "selected")>2023B</option>
<option value='ANT-20' $objResult1[model] = "ANT-20"(selected = "selected")>ANT-20</option>
<option value='CA-6412' $objResult1[model] = "CA-6412"(selected = "selected")>CA-6412</option>
<option value='HDR-1000' $objResult1[model] = "HDR-1000"(selected = "selected")>HDR-1000</option>
</select></td></tr>
<tr><td align="right">Company : </td><td align="left"><select name='company'>
<option value='MEASURETRONIX LTD.' $objResult1[company] = "MEASURETRONIX LTD."(selected = "selected")>MEASURETRONIX LTD.</option>
</select></td></tr>
<tr><td align="right">Price : </td><td align="left">$objResult1[price]</td></tr>
<tr><td align="right">Dept User: </td><td align="left"><select name='dept_user'>
<option value='C&I' $objResult1[dept_user] = "C&I"(selected = "selected")>C&I</option>
<option value='FOP' $objResult1[dept_user] = "FOP"(selected = "selected")>FOP</option>
<option value='NA' $objResult1[dept_user] = "NA"(selected = "selected")>NA</option>
<option value='TX' $objResult1[dept_user] = "TX"(selected = "selected")>TX</option>
</select></td></tr>
<tr><td align="right">Main Purpose : </td><td align="left"><select name='main_purpose'>
<option value='All' $objResult1[main_purpose] = "All"(selected = "selected")>All</option>
<option value='Operation' $objResult1[main_purpose] = "Operation"(selected = "selected")>Operation</option>
</select></td></tr>
<tr><td align="right">Owner : </td><td align="left">$objResult1[owner]</td></tr>
<tr><td align="right">Receive year : </td><td align="left">$objResult1[receive_year]</td></tr>
<tr><td align="right">Status : </td><td align="left">$objResult1[status]</td></tr>
<tr><td align="right" valign="top">Remark : </td><td align="left">$objResult1[remark] </td></tr>
<tr><td align="right" valign="top">Asset Number : </td><td align="left">$objResult1[asset_number] </td></tr>
<tr><td></td><td align="left"><input type='submit' value='แก้ไข' name='smb_edit'><input type='submit' value='ยกเลิก' onClick='window.close();'></td></tr>
HTMLBLOCK;
echo "</table><br>";
echo "</form>";
}
?>
หน้านี้เป็นหน้า edit_action.php
Code (PHP)
<?php
session_start();
if($_SESSION['UserID'] == "")
{
echo "Please Login!";
exit();
}
if($_SESSION['Status'] != "USER")
{
echo "This page for Admin only!";
exit();
}
mysql_connect("localhost","root","root");
mysql_select_db("equipment");
$strSQL = "SELECT * FROM member WHERE UserID = '".$_SESSION['UserID']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.menu {
color: #FFFFFF;
}
.right {
text-align: right;
}
.table {
font-weight: normal;
background-color: #E9AA56;
}
-->
</style>
</head>
<body>
<table width="100%" border="0">
<tr>
<td height="144"><img src="head.jpg" width="100%" height="145" /></td>
</tr>
</table>
<table width="30%" border="0" align="left" >
<tbody>
<tr>
<td width="34%">ยินดีต้อนรับ คุณ :</td>
<td width="66%"><b><?php echo $objResult["Name"]?></b></td>
</tr>
</tbody>
</table>
<?php
echo '<br><table width="100%" border="0" class="boder" align="left" height="400">';
echo '<tr><td background="icon/h.gif" height="30" align="center"><b>แก้ไขรายละเอียดอุปกรณ์</b></td></tr>';
echo '<tr><td align="left" valign="top"><br>';
if(isset($_GET['smb_edit'])){
edit();
}
echo "</td></tr>";
echo "</table>";
function edit(){
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("equipment");
$id=$_GET["id"];
$serail_number = $_GET['serail_number'];
$region = $_GET['region'];
$descript = $_GET['descript'];
$brand = $_GET['brand'];
$model = $_GET['model'];
$company = $_GET['company'];
$price = $_GET['price'];
$dept_user = $_GET['dept_user'];
$maim_purpose = $_GET['maim_purpose'];
$owner = $_GET['owner'];
$receive_year = $_GET['receive_year'];
$status = $_GET['status'];
$remark = $_GET['remark'];
$asset_number = $_GET['asset_number'];
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("equipment");
$sql = "update equipment_store set serial_number='".$serial_number."', region='".$region."', descript='".$descript."', brand='".$brand."',
model='".$model."', company='".$company."', price='".$price."', dept_user='".$dept_user."', main_purpose='".$main_purpose."',
owner='".$owner."', receive_year='".$receive_year."', status='".$status."', remark='".$remark."', asset_number='".$asset_number."'
where equip_id='".$equip_id."'";
mysql_query($sql);
$sql = "select * from equipment_store where equip_id ='".$id."' order by equip_id desc";
$result = mysql_query($sql);
$objResult1 = mysql_fetch_array($result)
?>
<?php
echo "<table border='1' width='30%' align='center' bgcolor='#FFFF99'>";
echo <<<HTMLBLOCK
<tr><td align="right" width="30%">Serial Number : </td><td align="left">$objResult1[serial_number]</td></tr>
<tr><td align="right" width="30%">Region : </td><td align="left"><select name='region'>
<option value='NOE' $objResult1[region] = "NOE"(selected = "selected")>NOE</option>
<option value='NOR' $objResult1[region] = "NOR"(selected = "selected")>NOR</option>
<option value='CWE' $objResult1[region] = "CWE"(selected = "selected")>CWE</option>
<option value='SOU' $objResult1[region] = "SOU"(selected = "selected")>SOU</option>
<option value='BKN' $objResult1[region] = "BKN"(selected = "selected")>BKN</option>
<option value='BKS' $objResult1[region] = "BKS"(selected = "selected")>BKS</option>
</select></td></tr>
<tr><td align="right" valign="top">Equipment : </td><td align="left"><select name='descript'>
<option value='INFRARED THERMOMETER' $objResult1[descript] = "INFRARED THERMOMETER"(selected = "selected")>INFRARED THERMOMETER</option>
<option value='Signal Generator' $objResult1[descript] = "Signal Generator"(selected = "selected")>Signal Generator</option>
<option value='Advanced Network Tester' $objResult1[descript] = "Advanced Network Tester"(selected = "selected")>Advanced Network Tester</option>
<option value='Digital Earth Tester' $objResult1[descript] = "Digital Earth Tester"(selected = "selected")>Digital Earth Tester</option>
<option value='Automatic Voltage Stabilizer' $objResult1[descript] = "Automatic Voltage Stabilizer"(selected = "selected")>Automatic Voltage Stabilizer</option>
<option value='Barcode Scanner' $objResult1[descript] = "Barcode Scanner"(selected = "selected")>Barcode Scanner</option>
</select></td></tr>
<tr><td align="right" valign="top">Brand : </td><td align="left"><select name='brand'>
<option value='FLUKE' $objResult1[brand] = "FLUKE"(selected = "selected")>FLUKE</option>
<option value='NEC' $objResult1[brand] = "NEC"(selected = "selected")>NEC</option>
<option value='ACTERNA' $objResult1[brand] = "ACTERNA"(selected = "selected")>ACTERNA</option>
<option value='CHAUVIN ARNOUX' $objResult1[brand] = "CHAUVIN ARNOUX"(selected = "selected")>CHAUVIN ARNOUX</option>
<option value='Stabilizer' $objResult1[brand] = "Stabilizer"(selected = "selected")>Stabilizer</option>
</select></td></tr>
<tr><td align="right">Model : </td><td align="left"><select name='model'>
<option value='62' $objResult1[model] = "62"(selected = "selected")>62</option>
<option value='2023B' $objResult1[model] = "2023B"(selected = "selected")>2023B</option>
<option value='ANT-20' $objResult1[model] = "ANT-20"(selected = "selected")>ANT-20</option>
<option value='CA-6412' $objResult1[model] = "CA-6412"(selected = "selected")>CA-6412</option>
<option value='HDR-1000' $objResult1[model] = "HDR-1000"(selected = "selected")>HDR-1000</option>
</select></td></tr>
<tr><td align="right">Company : </td><td align="left"><select name='company'>
<option value='MEASURETRONIX LTD.' $objResult1[company] = "MEASURETRONIX LTD."(selected = "selected")>MEASURETRONIX LTD.</option>
</select></td></tr>
<tr><td align="right">Price : </td><td align="left">$objResult1[price]</td></tr>
<tr><td align="right">Dept User: </td><td align="left"><select name='dept_user'>
<option value='C&I' $objResult1[dept_user] = "C&I"(selected = "selected")>C&I</option>
<option value='FOP' $objResult1[dept_user] = "FOP"(selected = "selected")>FOP</option>
<option value='NA' $objResult1[dept_user] = "NA"(selected = "selected")>NA</option>
<option value='TX' $objResult1[dept_user] = "TX"(selected = "selected")>TX</option>
</select></td></tr>
<tr><td align="right">Main Purpose : </td><td align="left"><select name='main_purpose'>
<option value='All' $objResult1[main_purpose] = "All"(selected = "selected")>All</option>
<option value='Operation' $objResult1[main_purpose] = "Operation"(selected = "selected")>Operation</option>
</select></td></tr>
<tr><td align="right">Owner : </td><td align="left">$objResult1[owner]</td></tr>
<tr><td align="right">Receive year : </td><td align="left">$objResult1[receive_year]</td></tr>
<tr><td align="right">Status : </td><td align="left">$objResult1[status]</td></tr>
<tr><td align="right" valign="top">Remark : </td><td align="left">$objResult1[remark] </td></tr>
<tr><td align="right" valign="top">Asset Number : </td><td align="left">$objResult1[asset_number] </td></tr>
HTMLBLOCK;
echo '<tr><td colspan="2" align="center"><br><input type=button value=" ปิดหน้านี้ " onClick="javascript:window.close();"></td></tr>';
echo "</table><br>";
}
?>
ปัญหาของหนูก็คือว่า มันไม่แสดงข้อมูลก่อนหน้าที่บันทึกไว้ เพื่อต้องการทราบข้อมูลก่อนการแก้ไข รบกวนผู้เชี่ยวชาญแนะนำหน่อยนะค่ะ หนูเป็นมือใหม่ เขียนไม่ค่อยจะเป็นเท่าไหร่ และหนูได้ดูโค้ดที่เกี่ยวกับเรื่องนี้ในกระทู้ของคนอื่น แต่ก็ยังไม่สามารถทำได้ รบกวนหน่อยนะค่ะ ขอบคุณค่ะ
Tag : PHP, MySQL, Ms SQL Server 2005, Ms SQL Server 2008, HTML/CSS
|
|
|
|
|
|
Date :
2011-12-19 12:04:28 |
By :
nooaomzaa |
View :
1003 |
Reply :
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$sql1 = "select * from equipment_store where equip_id ='".$id."' order by equip_id desc";
echo $sql1;
ลองดูว่ามันมีค่า $id หรือไม่
$sql1 = "select * from equipment_store where equip_id ='".$id."' order by equip_id desc";
|
|
|
|
|
Date :
2011-12-19 13:06:07 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
หนูลองทำตาม link ที่พี่ omega ให้มา ก็ยังไม่แสดงข้อมูลเลย
หน้า edit.php
Code (PHP)
<?php
session_start();
if($_SESSION['UserID'] == "")
{
echo "Please Login!";
exit();
}
if($_SESSION['Status'] != "USER")
{
echo "This page for Admin only!";
exit();
}
mysql_connect("localhost","root","root");
mysql_select_db("equipment");
$strSQL = "SELECT * FROM member WHERE UserID = '".$_SESSION['UserID']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.menu {
color: #FFFFFF;
text-decoration: none;
}
.right {
text-align: right;
}
.center {
font-weight: bold;
text-align: center;
}
.link {
text-decoration: none;
text-align: center;
font-weight: bold;
color: #FF0000;
}
.link_table {
color: #000000;
text-decoration: none;
}
-->
</style>
</head>
<body>
<table width="100%" border="0">
<tr>
<td height="144"><img src="head.jpg" width="100%" height="145" /></td>
</tr>
</table>
<table width="30%" border="0" align="right" cellspacing="2" class="link" >
<tr>
<td width="50%" height="27" align="center" bgcolor="#FFFF00" class="link"><a href="add_equipment.php" class="link">เพิ่มข้อมูล</a></td>
<td width="50%" align="center" bgcolor="#FFFF00"><a href="logout.php" class="link">ออกจากระบบ</a></td>
</tr>
</table>
<table width="30%" border="0" align="left" >
<tbody>
<tr>
<td width="34%">ยินดีต้อนรับ คุณ :</td>
<td width="66%"><b><?php echo $objResult["Name"]?></b></td>
</tr>
</tbody>
</table>
<form action="edit_save.php?equip_id=<?php echo $_GET["equip_id"]?>" name="frmEdit" method="post">
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("equipment");
$equip_id= $_GET["equip_id"];
$strSQL1 = "SELECT * FROM equipment_store WHERE equip_id = '".$_GET["equip_id"]."' ";
$objQuery1 = mysql_query($strSQL1);
$objResult1 = mysql_fetch_array($objQuery1);
if(!$objResult1)
{
echo "Not found equip_id=".$_GET["equip_id"];
}
else
{
?><br><br><br><p align="center"><b>แก้ไขรายละเอียดอุปกรณ์</b></p>
<?php echo "<br><table border='1' width='30%' align='center' bgcolor='#FFFF99'>";
echo <<<HTMLBLOCK
<tr><td align="right" width="30%">Serial Number : </td><td>$objResult1[serial_number]</td></tr>
<tr><td align="right" width="30%">Region : </td><td>$objResult1[region]</td></tr>
<tr><td align="right" valign="top">Equipment : </td><td>$objResult1[descript]</td></tr>
<tr><td align="right" valign="top">Brand : </td><td>$objResult1[brand]</td></tr>
<tr><td align="right">Model : </td><td>$objResult1[model]</td></tr>
<tr><td align="right">Company : </td><td>$objResult1[company]</td></tr>
<tr><td align="right">Price : </td><td>$objResult1[price]</td></tr>
<tr><td align="right">Dept User: </td><td>$objResult1[dept_user]</td></tr>
<tr><td align="right">Main Purpose : </td><td>$objResult1[main_purpose]</td></tr>
<tr><td align="right">Owner : </td><td>$objResult1[owner]</td></tr>
<tr><td align="right">Receive year : </td><td>$objResult1[receive_year]</td></tr>
<tr><td align="right">Status : </td><td>$objResult1[status]</td></tr>
<tr><td align="right" valign="top">Remark : </td><td>$objResult1[remark] </td></tr>
<tr><td align="right" valign="top">Asset Number : </td><td>$objResult1[asset_number] </td></tr>
<td colspan="2" align="center">
<input type="submit" value="save" />
<input type="reset" value="cancel"/></td></tr>
HTMLBLOCK;
echo "</table><br>";
?>
<?
}
mysql_close($objConnect);
?>
</form>
?>
</body>
</html>
หน้า edit_save.php
Code (PHP)
<html>
<head>
<title></title>
</head>
<body>
<?php
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("equipment");
$strSQL = "UPDATE equip_store SET ";
$strSQL .="('".$_POST["serial_number"]."','".$_POST["region"]."','".$_POST["descript"]."','".$_POST["brand"]."' ";
$strSQL .=",'".$_POST["model"]."','".$_POST["company"]."','".$_POST["price"]."','".$_POST["dept_user"]."'";
$strSQL .=",'".$_POST["main_purpose"]."','".$_POST["owner"]."','".$_POST["receive_year"]."','".$_POST["status"]."'";
$strSQL .=",'".$_POST["remark"]."','".$_POST["asset_number"]."')";
$strSQL .="WHERE equip_id = '".$_GET["equip_id"]."' ";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo "Save Done.";
}
else
{
echo "Error Save [".$strSQL."]";
}
mysql_close($objConnect);
?>
</body>
</html>
ไม่ทราบว่าหนูเขียนผิดตรงไหนค่ะ
|
|
|
|
|
Date :
2011-12-19 15:12:38 |
By :
nooaomzaa |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1. ในเบสมีข้อมูลยัง
2. การเชื่อมต่อถูกต้องไหม ชื่อเบส ชื่อตาราง ตรงไหม
3. ชื่อตัวแปรที่ใช้เหมือนกันป่าว
4. โค้ดตัวอย่างรันได้นะครับ แค่เพิ่มเบสของตัวอย่างนะ และก็เปลี่ยนรหัสการเชื่อมต่อเบส เท่านี้ก็รันทดสอบได้แล้วนะ
5. ตรงนี้น่ะ $objConnect = mysql_connect("localhost","root","root") คำว่า root ช่องสุดท้ายน่ะ เป็นพาสที่ใช้เชื่องต่อกับเบสนะ ของคุณเป็น root หรือป่าว
6. นอกนั้นก็ไม่รู้แฮะว่าทำไมโค้ดตัวอย่างถึงไม่ทำงานน่ะ
|
|
|
|
|
Date :
2011-12-19 17:05:52 |
By :
ozma |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผลลัพธ์ออกมาเป็นยังไงครับ
ดูโค้ดดีดีครับ php แทรกใน html , และ html แทรกใน php
ตามที่ผมเห็น
Code (PHP)
<?php echo "<br><br><table border='1' width='30%' align='center' bgcolor='#FFFF99' class='.right'>";
echo <<<HTMLBLOCK
<p align="center"><strong>แก้ไขรายละเอียดอุปกรณ์</strong></p>
<tr><td align="right" width="30%">Serial Number : </td><td align="left">$objResult1[serial_number]</td></tr>
<tr><td align="right" width="30%">Region : </td><td align="left"><select name='region'>
<option value='NOE' $objResult1[region] = "NOE"(selected = "selected")>NOE</option>
<option value='NOR' $objResult1[region] = "NOR"(selected = "selected")>NOR</option>
<option value='CWE' $objResult1[region] = "CWE"(selected = "selected")>CWE</option>
<option value='SOU' $objResult1[region] = "SOU"(selected = "selected")>SOU</option>
<option value='BKN' $objResult1[region] = "BKN"(selected = "selected")>BKN</option>
<option value='BKS' $objResult1[region] = "BKS"(selected = "selected")>BKS</option>
</select></td></tr>
<tr><td align="right" valign="top">Equipment : </td><td align="left"><select name='descript'>
<option value='INFRARED THERMOMETER' $objResult1[descript] = "INFRARED THERMOMETER"(selected = "selected")>INFRARED THERMOMETER</option>
<option value='Signal Generator' $objResult1[descript] = "Signal Generator"(selected = "selected")>Signal Generator</option>
<option value='Advanced Network Tester' $objResult1[descript] = "Advanced Network Tester"(selected = "selected")>Advanced Network Tester</option>
<option value='Digital Earth Tester' $objResult1[descript] = "Digital Earth Tester"(selected = "selected")>Digital Earth Tester</option>
<option value='Automatic Voltage Stabilizer' $objResult1[descript] = "Automatic Voltage Stabilizer"(selected = "selected")>Automatic Voltage Stabilizer</option>
<option value='Barcode Scanner' $objResult1[descript] = "Barcode Scanner"(selected = "selected")>Barcode Scanner</option>
</select></td></tr>
<tr><td align="right" valign="top">Brand : </td><td align="left"><select name='brand'>
<option value='FLUKE' $objResult1[brand] = "FLUKE"(selected = "selected")>FLUKE</option>
<option value='NEC' $objResult1[brand] = "NEC"(selected = "selected")>NEC</option>
<option value='ACTERNA' $objResult1[brand] = "ACTERNA"(selected = "selected")>ACTERNA</option>
<option value='CHAUVIN ARNOUX' $objResult1[brand] = "CHAUVIN ARNOUX"(selected = "selected")>CHAUVIN ARNOUX</option>
<option value='Stabilizer' $objResult1[brand] = "Stabilizer"(selected = "selected")>Stabilizer</option>
</select></td></tr>
<tr><td align="right">Model : </td><td align="left"><select name='model'>
<option value='62' $objResult1[model] = "62"(selected = "selected")>62</option>
<option value='2023B' $objResult1[model] = "2023B"(selected = "selected")>2023B</option>
<option value='ANT-20' $objResult1[model] = "ANT-20"(selected = "selected")>ANT-20</option>
<option value='CA-6412' $objResult1[model] = "CA-6412"(selected = "selected")>CA-6412</option>
<option value='HDR-1000' $objResult1[model] = "HDR-1000"(selected = "selected")>HDR-1000</option>
</select></td></tr>
<tr><td align="right">Company : </td><td align="left"><select name='company'>
<option value='MEASURETRONIX LTD.' $objResult1[company] = "MEASURETRONIX LTD."(selected = "selected")>MEASURETRONIX LTD.</option>
</select></td></tr>
<tr><td align="right">Price : </td><td align="left">$objResult1[price]</td></tr>
<tr><td align="right">Dept User: </td><td align="left"><select name='dept_user'>
<option value='C&I' $objResult1[dept_user] = "C&I"(selected = "selected")>C&I</option>
<option value='FOP' $objResult1[dept_user] = "FOP"(selected = "selected")>FOP</option>
<option value='NA' $objResult1[dept_user] = "NA"(selected = "selected")>NA</option>
<option value='TX' $objResult1[dept_user] = "TX"(selected = "selected")>TX</option>
</select></td></tr>
<tr><td align="right">Main Purpose : </td><td align="left"><select name='main_purpose'>
<option value='All' $objResult1[main_purpose] = "All"(selected = "selected")>All</option>
<option value='Operation' $objResult1[main_purpose] = "Operation"(selected = "selected")>Operation</option>
</select></td></tr>
<tr><td align="right">Owner : </td><td align="left">$objResult1[owner]</td></tr>
<tr><td align="right">Receive year : </td><td align="left">$objResult1[receive_year]</td></tr>
<tr><td align="right">Status : </td><td align="left">$objResult1[status]</td></tr>
<tr><td align="right" valign="top">Remark : </td><td align="left">$objResult1[remark] </td></tr>
<tr><td align="right" valign="top">Asset Number : </td><td align="left">$objResult1[asset_number] </td></tr>
<tr><td></td><td align="left"><input type='submit' value='แก้ไข' name='smb_edit'><input type='submit' value='ยกเลิก' onClick='window.close();'></td></tr>
HTMLBLOCK;
echo "</table><br>";
echo "</form>";
}
?>
Code (PHP)
echo <<<HTMLBLOCK
<p align="center"><strong>แก้ไขรายละเอียดอุปกรณ์</strong></p>
Code (PHP)
value='ยกเลิก' onClick='window.close();'></td></tr>
HTMLBLOCK;
|
|
|
|
|
Date :
2011-12-19 19:20:59 |
By :
yogolas |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ค่ะ อิอิ
|
|
|
|
|
Date :
2011-12-20 10:17:10 |
By :
nooaomzaa |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|