|
|
|
รบกวน หน่อย นะค่ะ พอหนู ไม่สามารถ แทรก code(มีตัวอย่างให้ดูค่ะ) นี้ได้ค่ะ ช่วยหน่อยน้า |
|
|
|
|
|
|
|
code ที่ต้องการ แทรก ใน หน้า หลัก ค่ะ
Code (PHP)
<?php
/*** By Weerachai Nukitram ***/
/*** http://www.ThaiCreate.Com ***/
$objConnect = mysql_connect("localhost","root","1191") or die("Error Connect to Database");
$objDB = mysql_select_db("stock it");
@mysql_query("SET NAMES UTF8");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>STOCK IT</title>
<script>
//**** List device (Start) ***//
function Listdevice(SelectValue)
{
frmMain.ddldevice.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.ddldevice.options[frmMain.ddldevice.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM device ORDER BY device_id ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = <?=$objResult["type_id"];?>;
strValue = "<?=$objResult["device_id"];?>";
strItem = "<?=$objResult["device_name"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.ddldevice.options[frmMain.ddldevice.length]= myOption
}
<?
}
?>
}
//**** List device (End) ***//
</script>
</head>
<form id="frmMain" method="post" enctype="multipart/form-data" action="Adddata_add_tel.php" onSubmit="return senddata();" target="uploadtarget">
<table width="347" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="141" height="30" align="left" valign="middle">Type</td>
<td width="204" height="30" align="left" valign="middle"><input name="type" type="text" id="type" value="Telephone" size="30" maxlength="30" /></td><td width="2"></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Device</td>
<td height="30" align="left" valign="middle">
<select id="ddltype" name="ddltype" onChange = "Listdevice(this.value)">
<option value=""></option>
<?
$strSQL = "SELECT * FROM type ORDER BY type_id ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResult["type_id"];?>" selected>
<?=$objResult["type_name"];?>
</option>
<?
}
?>
</select>
</td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Detail</td>
<td height="30" align="left" valign="middle"><select id="ddldevice" name="ddldevice" style="width:120px">
<option>choose</option>
</select></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Comment</td>
<td height="30" align="left" valign="middle"><textarea name="comment" cols="30" rows="3" id="comment"></textarea></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Name</td>
<td height="30" align="left" valign="middle"><select name="name" id="name">
<option selected="selected">Choose</option>
<option value="Utis S.">Utis S.</option>
<option value="Chaowalit J.">Chaowalit J.</option>
<option value="Boworn K.">Boworn K.</option>
<option value="Kittisak P.">Kittisak P.</option>
<option value="Varissara R.">Varissara R.</option>
</select></td>
</tr>
<tr>
<td height="30" colspan="2" align="center" valign="middle"><table width="311" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="155" height="30" align="center" valign="middle"><input type="submit" name="Update" id="Update" value="Update" /></td>
<td width="155" align="center" valign="middle"><input type="reset" name="cancel" id="button" value="cancel" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
<?
mysql_close($objConnect);
?>
Code หน้าหลักค่ะ
Code (PHP)
<!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">
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>-- Add Device --</title>
<head>
<script>
function senddata()
{
if (document.getElementById('type').value.length == 0)
{
alert('ระบุข้อมูลด้วยค่ะ');
return false;
}
document.getElementById('btnUpload').disabled = true;
return true;
}
function AddOk(type)
{
document.getElementById('message').innerHTML = 'เพิ่มข้อมูล '+type+'เรียบร้อยแล้ว';
document.getElementById('submit').disabled = false;
document.getElementById('AddPForm').reset();
return true ;
}
</script>
<style type="text/css">
body,td,th {
color: #000;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
}
#apDiv1 {
position:absolute;
left:11px;
top:48px;
width:533px;
height:20px;
z-index:3;
}
#apDiv2 {
position:absolute;
left:8px;
top:-27px;
width:1054px;
height:106px;
z-index:3;
}
#apDiv3 {
position:absolute;
left:51px;
top:69px;
width:124px;
height:50px;
z-index:1;
}
</style>
<style type="text/css">
#apDiv1 {
position:absolute;
left:130px;
top:400px;
width:749px;
height:294px;
z-index:1;
clip: rect(auto,10
.,auto,10);
}
body {
background-color: #FFF;
}
#apDiv2 {
position:absolute;
left:17px;
top:226px;
width:923px;
height:270px;
z-index:1;
}
</style>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#apDiv3 {
position:absolute;
left:762px;
top:575px;
width:54px;
height:24px;
z-index:2;
}
#apDiv4 {
position:absolute;
left:853px;
top:229px;
width:88px;
height:27px;
z-index:2;
}
a:link {
color: #333;
text-decoration: none;
}
a:visited {
color: #000;
text-decoration: none;
}
a:hover {
color: #FFF;
text-decoration: none;
}
a:active {
color: #000;
text-decoration: none;
}
.big {
font-size: 20px;
color: #000;
}
</style>
</head>
<body>
<div id="apDiv2">
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex="0">Telephone</li>
<li class="TabbedPanelsTab" tabindex="0">Computer</li>
<li class="TabbedPanelsTab" tabindex="0">Printer</li>
<li class="TabbedPanelsTab" tabindex="0">Network</li>
<li class="TabbedPanelsTab" tabindex="0">Other</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent">
<table width="920" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="382" rowspan="2" valign="middle" bgcolor="#FFFFCC"><table width="384" height="243" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center" valign="middle" bgcolor="#FFFF99" class="big">Telephone</td>
</tr>
<tr>
<td height="207" align="center" valign="middle"><p><img src="Images/telephone.gif" width="209" height="188" /></p></td>
</tr>
</table></td>
<td width="523" height="10" align="center" bgcolor="#FFFFCC"> </td>
</tr>
<tr>
<td height="200" align="center" bgcolor="#FFFFCC">
</td>
</tr>
</table>
</div>
<div class="TabbedPanelsContent">
<table width="920" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="382" rowspan="2" valign="middle" bgcolor="#FFFFCC"><table width="384" height="243" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center" valign="middle" bgcolor="#FFFF99" class="big">Computer</td>
</tr>
<tr>
<td height="207" align="center" valign="middle"><p><img src="Images/computer_pc_resize.jpg" width="268" height="178" /></p></td>
</tr>
</table></td>
<td width="523" height="10" align="center" bgcolor="#FFFFCC"> </td>
</tr>
<tr>
<td height="200" align="center" bgcolor="#FFFFCC"><form action="Adddata.php" method="post">
<ifame id="uploadtaret" name="uploadtarget" src=""
style="width:0px;height:0px;border:0"></ifame>
</form>
<form id="AddPForm" method="post" enctype="multipart/form-data" action="Adddata.php" onSubmit="return senddata();" target="uploadtarget">
<table width="310" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="115" height="30" align="left" valign="middle">Type</td>
<td width="195" height="30" align="left" valign="middle"><input name="type" type="text" id="type" value="Computer" size="30" maxlength="30" /></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Device</td>
<td height="30" align="left" valign="middle"><select name="Device" id="Device">
</select></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Detail</td>
<td height="30" align="left" valign="middle"><select name="Detail" id="Detail">
</select></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Comment</td>
<td height="30" align="left" valign="middle"><textarea name="comment" cols="30" rows="3" id="comment"></textarea></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Name</td>
<td height="30" align="left" valign="middle"><select name="name" id="name">
<option selected="selected">Choose</option>
<option value="Utis S.">Utis S.</option>
<option value="Chaowalit J.">Chaowalit J.</option>
<option value="Boworn K.">Boworn K.</option>
<option value="Kittisak P.">Kittisak P.</option>
<option value="Varissara R.">Varissara R.</option>
</select></td>
</tr>
<tr>
<td height="30" colspan="2" align="center" valign="middle"><table width="311" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="155" height="30" align="center" valign="middle"><input type="submit" name="Update" id="Update" value="Update" /></td>
<td width="155" align="center" valign="middle"><input type="reset" name="cancel" id="button" value="cancel" /></td>
</tr>
</table></td>
</tr>
</table>
</form></td>
</tr>
</table>
</div>
<div class="TabbedPanelsContent">
<table width="920" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="382" rowspan="2" valign="middle" bgcolor="#FFFFCC"><table width="384" height="243" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center" valign="middle" bgcolor="#FFFF99" class="big">Printer</td>
</tr>
<tr>
<td height="207" align="center" valign="middle"><p><img src="Images/printer.jpg" width="167" height="193" /></p></td>
</tr>
</table></td>
<td width="523" height="10" align="center" bgcolor="#FFFFCC"> </td>
</tr>
<tr>
<td height="200" align="center" bgcolor="#FFFFCC"><form action="Adddata.php" method="post">
<ifame id="uploadtaret" name="uploadtarget" src=""
style="width:0px;height:0px;border:0"></ifame>
</form>
<form id="AddPForm" method="post" enctype="multipart/form-data" action="Adddata.php" onSubmit="return senddata();" target="uploadtarget">
<table width="310" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="115" height="30" align="left" valign="middle">Type</td>
<td width="195" height="30" align="left" valign="middle"><input name="type" type="text" id="type" value="Printer" size="30" maxlength="30" /></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Device</td>
<td height="30" align="left" valign="middle"><select name="Device" id="Device">
</select></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Detail</td>
<td height="30" align="left" valign="middle"><select name="Detail" id="Detail">
</select></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Comment</td>
<td height="30" align="left" valign="middle"><textarea name="comment" cols="30" rows="3" id="comment"></textarea></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Name</td>
<td height="30" align="left" valign="middle"><select name="name" id="name">
<option selected="selected">Choose</option>
<option value="Utis S.">Utis S.</option>
<option value="Chaowalit J.">Chaowalit J.</option>
<option value="Boworn K.">Boworn K.</option>
<option value="Kittisak P.">Kittisak P.</option>
<option value="Varissara R.">Varissara R.</option>
</select></td>
</tr>
<tr>
<td height="30" colspan="2" align="center" valign="middle"><table width="311" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="155" height="30" align="center" valign="middle"><input type="submit" name="Update" id="Update" value="Update" /></td>
<td width="155" align="center" valign="middle"><input type="reset" name="cancel" id="button" value="cancel" /></td>
</tr>
</table></td>
</tr>
</table>
</form></td>
</tr>
</table>
</div>
<div class="TabbedPanelsContent">
<table width="920" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="382" rowspan="2" valign="middle" bgcolor="#FFFFCC"><table width="384" height="243" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center" valign="middle" bgcolor="#FFFF99" class="big">Network</td>
</tr>
<tr>
<td height="207" align="center" valign="middle"><p><img src="Images/ComputerNetwork.jpg" width="252" height="187" /></p></td>
</tr>
</table></td>
<td width="523" height="10" align="center" bgcolor="#FFFFCC"> </td>
</tr>
<tr>
<td height="200" align="center" bgcolor="#FFFFCC"><form action="Adddata.php" method="post">
<ifame id="uploadtaret" name="uploadtarget" src=""
style="width:0px;height:0px;border:0"></ifame>
</form>
<form id="AddPForm" method="post" enctype="multipart/form-data" action="Adddata.php" onSubmit="return senddata();" target="uploadtarget">
<table width="310" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="115" height="30" align="left" valign="middle">Type</td>
<td width="195" height="30" align="left" valign="middle"><input name="type" type="text" id="type" value="Network" size="30" maxlength="30" /></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Device</td>
<td height="30" align="left" valign="middle"><select name="Device" id="Device">
</select></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Detail</td>
<td height="30" align="left" valign="middle"><select name="Detail" id="Detail">
</select></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Comment</td>
<td height="30" align="left" valign="middle"><textarea name="comment" cols="30" rows="3" id="comment"></textarea></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Name</td>
<td height="30" align="left" valign="middle"><select name="name" id="name">
<option selected="selected">Choose</option>
<option value="Utis S.">Utis S.</option>
<option value="Chaowalit J.">Chaowalit J.</option>
<option value="Boworn K.">Boworn K.</option>
<option value="Kittisak P.">Kittisak P.</option>
<option value="Varissara R.">Varissara R.</option>
</select></td>
</tr>
<tr>
<td height="30" colspan="2" align="center" valign="middle"><table width="311" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="155" height="30" align="center" valign="middle"><input type="submit" name="Update" id="Update" value="Update" /></td>
<td width="155" align="center" valign="middle"><input type="reset" name="cancel" id="button" value="cancel" /></td>
</tr>
</table></td>
</tr>
</table>
</form></td>
</tr>
</table>
</div>
<div class="TabbedPanelsContent">
<table width="920" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="382" rowspan="2" valign="middle" bgcolor="#FFFFCC"><table width="384" height="243" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center" valign="middle" bgcolor="#FFFF99" class="big">Other</td>
</tr>
<tr>
<td height="207" align="center" valign="middle"><p><img src="Images/box.jpg" width="239" height="163" /></p></td>
</tr>
</table></td>
<td width="523" height="10" align="center" bgcolor="#FFFFCC"> </td>
</tr>
<tr>
<td height="200" align="center" bgcolor="#FFFFCC"><form action="Adddata.php" method="post">
<ifame id="uploadtaret" name="uploadtarget" src=""
style="width:0px;height:0px;border:0"></ifame>
</form>
<form id="AddPForm" method="post" enctype="multipart/form-data" action="Adddata.php" onSubmit="return senddata();" target="uploadtarget">
<table width="310" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="115" height="30" align="left" valign="middle">Type</td>
<td width="195" height="30" align="left" valign="middle"><input name="type" type="text" id="type" value="Other" size="30" maxlength="30" /></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Device</td>
<td height="30" align="left" valign="middle"><select name="Device" id="Device">
</select></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Detail</td>
<td height="30" align="left" valign="middle"><select name="Detail" id="Detail">
</select></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Comment</td>
<td height="30" align="left" valign="middle"><textarea name="comment" cols="30" rows="3" id="comment"></textarea></td>
</tr>
<tr>
<td height="30" align="left" valign="middle">Name</td>
<td height="30" align="left" valign="middle"><select name="name" id="name">
<option selected="selected">Choose</option>
<option value="Utis S.">Utis S.</option>
<option value="Chaowalit J.">Chaowalit J.</option>
<option value="Boworn K.">Boworn K.</option>
<option value="Kittisak P.">Kittisak P.</option>
<option value="Varissara R.">Varissara R.</option>
</select></td>
</tr>
<tr>
<td height="30" colspan="2" align="center" valign="middle"><table width="311" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="155" height="30" align="center" valign="middle"><input type="submit" name="Update" id="Update" value="Update" /></td>
<td width="155" align="center" valign="middle"><input type="reset" name="cancel" id="button" value="cancel" /></td>
</tr>
</table></td>
</tr>
</table>
</form></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div id="apDiv4">
<table width="80" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"><ul class="TabbedPanelsTabGroup">
<a href="index.html"><img src="Images/home_w.gif" width="23" height="21" border="0" /></a>
</ul></td>
<td align="center" valign="middle"><strong><a href="index.html">HOME</a></strong></td>
</tr>
</table>
</div>
<table width="841" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="8"><img src="Images/add.jpg" width="930" height="212" /></td>
</tr>
<tr>
<td width="8" align="center" valign="middle" bgcolor="#FFFFFF"> </td>
<td width="922" height="30" colspan="7" align="center" valign="middle" bgcolor="#FF9900"> </td>
</tr>
</table>
<script type="text/javascript">
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
</script>
</body>
</html>
Tag : MySQL, JavaScript, CakePHP
|
|
|
|
|
|
Date :
2011-05-11 09:47:46 |
By :
Bombam_SU |
View :
1396 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รูปภาพ ค่ะ
|
|
|
|
|
Date :
2011-05-11 09:52:02 |
By :
Bombam_SU |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
พี่ๆ ค่ะ ช่วยแนะ นำ หน่อยนะค่ะ พอดี ทำโปรเจต แล้วติดปัญหา นั่งแก้มาทั้งวันแล้ว อ่า ช่วยหน่อยนะค่ะ
|
|
|
|
|
Date :
2011-05-11 14:03:27 |
By :
Bombam_SU |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TT !!
|
|
|
|
|
Date :
2011-05-11 14:41:10 |
By :
Bombam_SU |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คือจะให้ form โชว์ หลังจาก เลือก listmenu ใช่หรือป่าวครับขอรายละเอียดเพิ่มเติมหน่อยครับหรือจะ
@msn
: webmaster[at]clubtrick.com
จะโพสในนี้หรือจะ @ สอบถามก็ได้นะครับแต่แนะนำแนวทางเบื้องต้นใช้ jquery ครับ
โดยการส่งข้อมูล ไปที่หน้าของ php และให้ php return ค่ากลับมาแสดงหนะครับ
|
|
|
|
|
Date :
2011-05-16 02:07:26 |
By :
exparenza |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|