hi,
I thought of doing this in a different way. I dont no whether u want this. but i think this will solve u`r problem.
Insted of using arrays i first grab the usefull parts to fill the combo box and fill it. then on combo changed i submit that form using JS. (I pass a hidden field also)
then i query again and get the results according to that combo value and display them. pretty simple.
here is the code just in case u need it.
<html>
<head>
<title>read Contents</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="post" action="help.php">
<select name="select" onchange="document.form1.submit()"> <!--document.form1.submit() == this will submit the form when the combo is changed-->
<?php
mysql_connect("localhost","","");
mysql_select_db("crm");
@$result=mysql_query("select * from customer");
while(@$row=mysql_fetch_array(@$result))
{
print "<option value=".$row[first].">$row[first]</option>"; //store the values in the combo box
}
?>
</select>
<input type="hidden" name="go" value="yes">
</form>
<?php
if(isset($go)) // if value is selected from combo box
{
@$result=mysql_query("select * from customer where first='".@$select."'");
@$row=mysql_fetch_array(@$result);
print " <br>";
print " <input type=\"text\" name=\"textfield\" value=\"".@$row[first]."\">";
print " <br>";
print " <input type=\"text\" name=\"textfield2\" value=\"".@$row[last]."\">";
print " <br>";
print " <input type=\"text\" name=\"textfield3\" value=\"".@$row[first]."\">";
}
else
{
print " <br>";
print " <input type=\"text\" name=\"textfield\">";
print " <br>";
print " <input type=\"text\" name=\"textfield2\">";
print " <br>";
print " <input type=\"text\" name=\"textfield3\">";
}
?>
</body>
</html>
hope this would help!!!!
regards,
Niroshan