|
 |
|
เลือกข้อมูลจาก listbox แล้วให้แสดงข้อมูลที่มีอยู่ในข้อที่เลือกออกมาแล้วมี textbox ต่อท้ายเพื่อกรอกข้อมูลลงไป เก็บในฐานข้อมมูล |
|
 |
|
|
 |
 |
|
น่าจะต้องใช้ Jump Menu ครับ โดยส่ง id เพื่อไปดึงข้อมูลในฐานข้อมูลมาแสดงครับ โดยอ่าน $_GET["id"] ไป Query ใน Database ครับ เหมือนตัวอย่างนี้ครับ
Code (PHP)
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM customer WHERE CustomerID = '".$_GET["CusID"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not found CustomerID=".$_GET["CusID"];
}
else
{
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">CustomerID </div></th>
<th width="160"> <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="70"> <div align="center">Budget </div></th>
<th width="70"> <div align="center">Used </div></th>
</tr>
<tr>
<td><div align="center"><input type="text" name="txtCustomerID" size="5" value="<?=$objResult["CustomerID"];?>"></div></td>
<td><input type="text" name="txtName" size="20" value="<?=$objResult["Name"];?>"></td>
<td><input type="text" name="txtEmail" size="20" value="<?=$objResult["Email"];?>"></td>
<td><div align="center"><input type="text" name="txtCountryCode" size="2" value="<?=$objResult["CountryCode"];?>"></div></td>
<td align="right"><input type="text" name="txtBudget" size="5" value="<?=$objResult["Budget"];?>"></td>
<td align="right"><input type="text" name="txtUsed" size="5" value="<?=$objResult["Used"];?>"></td>
</tr>
</table>
<input type="submit" name="submit" value="submit">
<?
}
mysql_close($objConnect);
?>
|
 |
 |
 |
 |
Date :
2012-01-25 06:32:37 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ครับ แต่การจะเอาค่าIDมาจะต้องเลือกจากlistboxมาก่อนอะครับ โดยที่listboxนั้นเอาค่ามาจากฐานข้อมูลอะครับ โดยใช้Dynamicครับไม่ได้ใช้List Valueอะครับผม
|
ประวัติการแก้ไข 2012-01-25 20:56:21
 |
 |
 |
 |
Date :
2012-01-25 20:39:06 |
By :
potkung11 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|