<?php
$q = $_REQUEST['q'];
//$a=$_REQUEST['sub_amendment[contractor]'];

// Connect to MySQL using mysqli procedural style
$con = mysqli_connect('localhost', 'root', '', 'jjrs_projects');

// Check connection
if (!$con) {
	die('Could not connect: ' . mysqli_connect_error());
}


$sql = "SELECT * FROM `sub_contractor_definition' A,`sub_preparation` B WHERE A.id=B.contractor AND B.id='" . $_REQUEST['q'] . "'";

$result = mysqli_query($con, $sql);
?>

<select name="sub_amendment[work_order_no]" id="work_order_no">
	<option value="">Select Work Order No</option>
	<?php while ($row = mysqli_fetch_array($result)) {
		$s = '';
		if ($contractor == $category_row['id'])
			$s = "selected";
	?>
		<option value="<?php //echo $row['id'];
						?>" <?php echo $s; ?>><?php echo $row['work_order_no']; ?></option>
	<?php } ?>
</select>";

<?php
mysqli_close($con);
?>