[PHP]<?
include("conn_db.php");
?>
<html>
<head>
<title>Customers</title>
<link href="css/format.css" rel="stylesheet" type="text/css">
</head>
<body>
<form name="form">
<table width="136" border="1">
<tr>
<td width="126"><table width="126" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="126" align="center" bgcolor="#FF0000" class="header">Dealers / Corporate</td>
</tr>
<tr>
<td align="center">
<?
$code = mysql_query ("SELECT so.so_no, fs.form_status as status, ct.cust_type as customer_type, so.cust_id,
c.company as customer, c.tin, c.contact, c.address, cy.name as city, p.name as province,
c.area_code, c.phone_no, c.fax_no, c.mobile_no, c.email, pr.description as product,
so.serial_no, pc.prod_cat as product_category, pr.model_no, pa.part_desc as part_desc, sp.qty, m.description, sm.qty,
u.username as prepared_by, t.last_name as tlname, t.first_name as tfname, t.middle_name as tmname,
u.username as costing_approved, labor, spare_parts, materials, total_charges
FROM service_order as so
LEFT JOIN forms_status as fs ON fs.form_status_id = so.status
LEFT JOIN customer_type as ct ON ct.cust_type_id = so.cust_type_id
LEFT JOIN customer as c ON c.cust_id = so.cust_id
LEFT JOIN city as cy ON cy.city_id = c.city_id
LEFT JOIN province as p ON p.province_id = c.province_id
LEFT JOIN product as pr ON pr.prod_id = so.prod_id
LEFT JOIN product_category as pc ON pc.code_cat = pr.code_cat
INNER JOIN so_parts AS sp ON so.so_no = sp.so_no
LEFT JOIN parts AS pa ON pa.part_id = sp.part_id
INNER JOIN so_materials AS sm ON so.so_no = sm.so_no AND sp.parts_so_id = sm.parts_so_id
LEFT JOIN material AS m ON m.material_id = sm.mat_id
LEFT JOIN user as u ON u.user_id = so.prepared_by
LEFT JOIN technician as t ON t.tech_id = so.service_tech
WHERE so.cust_id != 'NULL' AND ct.cust_type_id = '2'");
?>
<select name="customers" size="10" class="txtreq" onChange="goCorDeal()" style="width:125px">
<?
while($row = mysql_fetch_array($code))
{
$so_no = $row["so_no"];
$cust_id = $row["cust_id"];
$company = $row["customer"];
$tin = $row["tin"];
$contact = $row["contact"];
$address = $row["address"];
$city = $row["city"];
$province = $row["province"];
$areacode = $row["area_code"];
$phone = $row["phone_no"];
$areacode2 = $areacode;
$fax = $row["fax_no"];
$mobile = $row["mobile_no"];
$email = $row["email"];
$prod_id = $row["prod_id"];
$product = $row["product"];
$category = $row["product_category"];
$serial = $row["serial_no"];
$model = $row["model_no"];
$prepared_by = $row["user"];
$costing_approved = $row["user"];
$tlname = $row["tlname"];
$tfname = $row["tfname"];
$tmname = $row["tmname"];
$technician = $tlname.", ".$tfname." ".$tmname;
$labor = $row["labor"];
$spare_parts = $row["spare_parts"];
$materials = $row["materials"];
$total_charges = $row["total_charges"];
$part_desc = $row["part_desc"];
print "<option value='$so_no`$cust_id`$company`$tin`$contact`$add ress`$city`$province`$areacode`$phone`$areacode2`$ fax`$mobile`$email`$prod_id`$product`$category`$se rial`$model`$labor`$spare_parts`$materials`$total_ charges`$part_desc'>SO №: ".$so_no."</option>\n";
?>
<script type="text/javascript">
function goCorDeal()
{
var names = document.form.customers.options[document.form.customers.selectedIndex].value;
var temp = new Array();
temp = names.split('`');
for(i=0;i<='<?=$so_no?>';i++)
{
self.opener.document.form1.so_no.value = temp[0];
self.opener.document.form1.cust_id.value = temp[1];
self.opener.document.form1.company.value = temp[2];
self.opener.document.form1.tin.value = temp[3];
self.opener.document.form1.contactperson.value = temp[4];
self.opener.document.form1.address.value = temp[5];
self.opener.document.form1.city.value = temp[6];
self.opener.document.form1.province.value = temp[7];
self.opener.document.form1.areacode.value = temp[8];
self.opener.document.form1.phone.value = temp[9];
self.opener.document.form1.areacode2.value = temp[10];
self.opener.document.form1.fax.value = temp[11];
self.opener.document.form1.mobile.value = temp[12];
self.opener.document.form1.email.value = temp[13];
self.opener.document.form1.prod_id.value = temp[14];
self.opener.document.form1.product.value = temp[15];
self.opener.document.form1.category.value = temp[16];
self.opener.document.form1.serial.value = temp[17];
self.opener.document.form1.model.value = temp[18];
self.opener.document.form1.labor.value = temp[19];
self.opener.document.form1.spareparts.value = temp[20];
self.opener.document.form1.materials.value = temp[21];
self.opener.document.form1.total_charges.value = temp[22];
}
<?
$desc_array = count($part_desc);
for($x=0; $x<=$desc_array; $x++)
{?>
self.opener.document.form1.particles[<?=$x;?>].value=<?echo $part_desc[$x];?>;
<?
}?>
window.close();
}
</script>
<?
}
?>
</select>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>[/PHP]
here's the complete code.