<div style="display: none;" id="dialog_add_client" title="Register Module">
		<form class="full validate" method="POST" action="module_register.php">
			<div class="row">
				<label for="d2_role">
					<strong>Module</strong>
				</label>
				<div>
					<select name="module" style="padding-bottom: 10px" id="d2_role" required class="search required" data-placeholder="Choose a Role">
						<option></option>
						<?php
							$query2 = "SELECT term,code,module FROM modules m WHERE year='$y' AND NOT EXISTS(SELECT module_code FROM module_reg s WHERE m.code=s.module_code AND s.year=m.year AND m.year='$y' AND s.st_id='$user')";
							$subject_set2 = mysqli_query($connection,$query2); 
								//4. Use return data

							while($row2 = mysqli_fetch_array($subject_set2)) 
							{?>
								 <option  <?php if($module == ($row2['code'])) echo 'selected="selected"'; ?> ><?php echo $row2['code']; ?></option>
							<?php
							}
						?>
					</select>
				</div>
			</div>
			<div class="row">
				<div class="right">
					<button type="submit" name="register">Register Module</button>
				</div>
			</div>
		</form>
	</div>