|
 |
|
แก้ไขข้อมูลครับ ที่เป็น list ให้เลือก แก้ไขข้อมูลครับ ที่เป็น list ให้เลือก จะทำไงให้แสดงข้อมูลเดิมแต่เป็น |
|
 |
|
|
 |
 |
|
ต้องสร้าง table มานึง table ก่อนน่ะครับจากนั้นก็เก็บข้อมูลจังหวัดไวครับ เช่น id,ชื่อจังหวัด แล้วจากนั้นก็ทำการให้ table ที่เก็บ id,ชื่อจังหวัด ให้ relation กับ table ที่ต้องการ เช่น table สมาชิกประมาณนี้ครับ จากนั้นก็ทำการ
select table ที่เก็บข้อมูลจังหวัดมาอยู่ใน list ครับ แล้วก็กำหนอ value ของ list ครับ ให้ตรงกับจังหวัดที่ต้องการครับ แล้วใช้ value ในการตรวจสอบและเก็บค่าครับ
ปล. table ที่เก็บ d,ชื่อจังหวัด ต้องทำาการคีเข้าไปน่ะครับ ถ้างงบอกน่ะครับ
|
 |
 |
 |
 |
Date :
2009-04-30 10:53:15 |
By :
muj |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมเขียนแบบนี้ครับดึงมาจากฐานข้อมูลเลยมันก็ไม่ขึ้น
<select name="province_name" id="province_name">
<option selected>--เลือก--</option>
<?
session_start();
include("connect.php");
include("tbname.php");
$sql="select * from $TBName1";
$db_query=mysql_db_query($dbname,$sql);
$num_rows=mysql_num_rows($db_query);
$x=0;
while($x<$num_rows)
{
$result= mysql_fetch_array($db_query);
$province_name=$result[province_name];
$id=$result[id];
if($row[province_name]==$id) { $se="selected" ;}else{ $se="";}
echo "<option value='$id' $se > $province_name</option>";
$x++;
}
?>
</select>
|
 |
 |
 |
 |
Date :
2009-04-30 11:24:59 |
By :
ak47 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
echo "<option value='$id' $se > $province_name</option>"; ตรงนี้ครับ
ต้องเป็นแบบนี้ครับ
<option value="<?php echo $row["province_id"] ?>"><?php echo $row["province_name"] ?></option>
|
 |
 |
 |
 |
Date :
2009-04-30 11:29:48 |
By :
kanchen |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่ขึ้นอยู่ดีอ่ะ
|
 |
 |
 |
 |
Date :
2009-04-30 11:50:24 |
By :
ak47 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอา code ที่แก้ไปมาให้ดูหน่อยครับ
|
 |
 |
 |
 |
Date :
2009-04-30 12:21:05 |
By :
kanchen |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|