include_once "wines.php";
$obj1 = new wines();
$obj1->get_wine_type();
while ($row = $obj1->fetch()) {
    echo "<option value='{$row['wine_type_id']}''>{$row['wine_type']}</option>";
}
?>
						</select>
				</div><br>
			<div>Year: <input type="text" name="yr" size="30" required></div><br>
			<div>Winery: <select name="winery_id">
							<option value="0">--Select Winery--</option>
							<?php 
include_once "wines.php";
$obj2 = new wines();
$obj2->get_winery();
while ($row = $obj2->fetch()) {
    echo "<option value='{$row['winery_id']}''>{$row['winery_name']}</option>";
}
?>
						</select>
				</div><br>
			<div>Description: <textarea name="wd" cols="30" rows="5"></textarea></div><br>
			
			<input type="submit" name="do" value="ADD">
		</form>
		<form action="upload.php" method="post" enctype="multipart/form-data">
			Select image to upload: 
			<input type="file" name="fileToUpload" id="fileToUpload">
			<input type="submit" value="Upload Image" name="submit">
		</form>
    } else {
        echo "<option value='{$obj1['wine_type_id']}'>{$obj1['wine_type']}</option>";
    }
}
?>
			</select></div><br>
			<div>Year: <input type="text" value="<?php 
echo $row['year'];
?>
" name="yr" id="yr"></div><br>
			<div>Winery: <select name="winery_id" id="winery_id">
						<option value="0">--Select Winery--</option>
						<?php 
include_once "wines.php";
$obj = new wines();
$obj->get_winery();
while ($obj1 = $obj->fetch()) {
    if ($obj1['winery_id'] == $row['winery_id']) {
        echo "<option value='{$obj1['winery_id']}' selected>{$obj1['winery_name']}</option>";
    } else {
        echo "<option value='{$obj1['winery_id']}'>{$obj1['winery_name']}</option>";
    }
}
?>
						</select></div><br>
			<div>Description: <textarea name="wd" id="wd" cols="30" rows="5" value="<?php 
echo $row['description'];
?>
"></textarea></div>
			<input type="submit" value="UPDATE">
		</form>