index.php
<!DOCTYPE html>
</html>
<body>
<form name="fruits" action="selectexec.php" method="post">
<select name="department">
<option value="apple">apple</option>
<option value="mango">mango</option>
<option value="orange">orange</option>
</select>
<select name="company">
<option value="ASUS">ASUS</option>
<option value="LENOVO">LENOVO</option>
<option value="ACER">ACER</option>
</select>
<input type="submit" name="submit" />
</form>
</body>
</html>
selectexe.php
<?php
include_once('pdo-connect.php');
if(isset($_POST['submit'])){
$department=$_POST['department'];
$company=$_POST['company'];
// SQL statements
$sql = "INSERT INTO selectformtbl (department,company)values('$department',$company)";
$db->exec($sql);
}
?>