update.php

<?php 
include 'connect.php';
?>

<html>
<body>	
	<form action = "update_user.php" method="POST">   
				
				<label for="id">Enter the ID</label>
				<input type="number" name="id" required>
				
				<select name="fieldname">
				<option value="">--- Choose the field you want to update ---</option>
				<option value="ID">ID</option>
				<option value="name">Name</option>
				</select>
										
		
				<label for="NewValue">Enter the new value</label>
				<input type="text" name="newvalue" required>					
				<button type="submit">Submit </button>						     
	</form>
</body>
</html>
	
?>

update_info.php

	
	<?php
	session_start();
	include 'connect.php';


	$id = $_POST['id']; 
	$field_name = $_POST['fieldname']; 
	$new_value = $_POST['newvalue'];
		
		$sql = "UPDATE employee SET $field_name = '$new_value' WHERE ID = '$id'";
		
		if(mysqli_query($conn, $sql)){
				echo "Recorded Updated Successfully";
		} else{
				echo "Record not updated";

		}
		
		mysqli_close($conn);
}