<?php
// ** connect your database
// ** and then
$sql = "SELECT * FROM agent ORDER BY Agent_name ASC";
$result = mysql_query($sql);
if( @mysql_num_rows($result) > 0 ){
while( $rec = mysql_fetch_array($result)){
$list .= '<option value="'.$rec['Agent_id'].'" ondblclick="view_agent('.$rec['Agent_id'].')" >'.$rec['Agent_name'].'</option>';
}
}
else $list = '<option value="-1">ยังไม่มีข้อมูลในส่วนนี้ </option>' ;
?>
<script>//ทำงานเมื่อมีการ ดับเบิลคลิก
function view_agent(id){
window.location="agent-present.php?id="+id ;
}
</script>
<select name="agent_data" id="agent_data" size="20" multiple="multiple" style="width:305px;">
<?=$list?>
</select>
agent-present.php // หน้าแสดงเนื้อหา Code (PHP)
<?
//** connect your database
//** and then
$id = $_GET['id'] ;
$sql = " SELECT * FROM agant WHERE Agant_id = ".$id ;
$result = mysql_query($sql);
//** and then up to you
?>