Hi sorry bout that...i'm not getting an error message. basically i want when i select outputs from a combo box, it will place these values in a text box and perform the search based on the string values in the text box.
here's the code to query the table which populates the outputs combobox:
mysql_select_db($database_connection, $connection);
$query_Outputs = "Select OP,OPName from outputs order by OP asc";
$Outputs = mysql_query($query_Outputs);
$row_Outputs = mysql_fetch_assoc($Outputs);
Then i have the following code:
if (isset($GET['OP'])){$Outputs = $GET['OP'];}
if (isset($GET['txtOP'])){$txtOP = $GET['txtOP'];}
if(isset($GET['selectOP'])){$selectedOP = $GET['selectOP'];}
if (strlen($selectedOP) != 0 and strpos($OP,$selectedOP) === false)
{if (strlen($OP) != 0)
{$OP = $OP." , ".$selectedOP;}
else
{$OP = $selectedOP;}
$query_SubcatResults = "Select SubcatID,SubcatName from subcategory where OP = '$OP' order by SubcatName asc";
$SubcatResults = mysql_query($query_SubcatResults);
$row_SubcatResults = mysql_fetch_assoc($SubcatResults);
}
else
{
$query_SubcatResults = "Select SubcatID,SubcatName from subcategory order by SubcatName asc";
$SubcatResults = mysql_query($query_SubcatResults);
$row_SubcatResults = mysql_fetch_assoc($SubcatResults);
$OP = "";
}
This code is attached to the combo box and text box:
<tr>
<td width="21%">Outputs</td>
<td width="79%"><div align="right">
<select name="selectOP" size="1" class="combo-size" id="selectOP" ;>
<option value="" <?php if (!(strcmp("", $row_Outputs['OP']))) {echo "SELECTED";} ?>></option>
<?php
do {
?>
<option value="<?php echo $row_Outputs['OP']?>"<?php if (isset($selectedOP) and !(strcmp($selectedOP, $row_Outputs['OP']))) {echo "SELECTED";} ?>><?php echo $row_Outputs['OP']." - ".$row_Outputs['OPName']?></option>
<?php
} while ($row_Outputs = mysql_fetch_assoc($Outputs));
$rows = mysql_num_rows($Outputs);
if($rows > 0) {
mysql_data_seek($Outputs, 0);
$row_Outputs = mysql_fetch_assoc($Outputs);
}
?>
</select>
</div></td>
</tr>
<tr>
<td>Selected <br> Outputs</td>
<td><div align="right">
<input name="OP" type="text" class="box-size" id="OP" value='<?php if(isset($OP)){echo($OP);}?>'>
</div></td>
</tr>