发送电子邮件时显示“姓名”而不是“ID”

I'm a beginner in PHP. now, I want to set sending emails. but unfortunetely, some field I use "ID" and will display "Name". Ex:

<div class="form-group">
                            <label for="contact_departement_id"><?php echo $lang['contact_departement_id'] ?></label>
                            <select class="form-control" name="contact_departement_id" id="contact_departement_id">
                                <option value="x"><?php echo $lang['chooseone'] ?></option>
                                <?php foreach($listDepartement['datas'] as $departement): ?>
                                    <option 
                                        <?php 
                                            echo ($state == 'edit') && ($departement->departement_id == $datas->contact_departement_id) ? 'selected="selected"': '';
                                        ?>
                                        value="<?php echo $departement->departement_id ?>">
                                        <?php echo $departement->departement_name ?>
                                    </option>
                                <?php endforeach ?>
                            </select>
                        </div>  

and I set in emails

$contact_name = $_POST['contact_name'];
$contact_ext = $_POST['contact_ext'];
$contact_direktorat_id = $_POST['contact_direktorat_id'];
$contact_departement_id = $_POST['contact_departement_id'];
$contact_lokasi_id = $_POST['contact_lokasi_id'];
//$mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted
$message = file_get_contents('mail.html'); 
    $message = str_replace('%contact_name%', $contact_name, $message); 
    $message = str_replace('%contact_ext%', $contact_ext, $message); 
    $message = str_replace('%contact_direktorat_id%', $contact_direktorat_id, $message); 
    $message = str_replace('%contact_departement_id%', $contact_departement_id, $message); 
    $message = str_replace('%contact_lokasi_id%', $contact_lokasi_id, $message); 

Output:

Dear All,

New Extention has been added. Here are details:
Contact Name: test
Ext: 123
Directorate: 2
Department: 2
Location: 4

I need some guidance how to display "Name" not "ID"

The form submits whatever is in the option element's value attribute, not the tag's content. You need to provide a mapping for your names, like:

$departments = [
    '1' => 'Sales',
    '2' => 'Support',
    '3' => 'Accounts',
];

You should validate the submitted values before using them (because clients may submit junk, hacking attempts etc), and then map them through the array, something like:

if (!array_key_exists($_POST['contact_direktorat_id'], $departments)) {
    $contact_direktorat_name = $departments[$_POST['contact_direktorat_id']];
} else {
    $contact_direktorat_name = 'Unknown';
}

Repeat this with however many of these you need, define as many arrays as you need, or perhaps look up the values in a database to validate them instead of using arrays (though be sure not to open yourself to SQL injection attacks) - you get the general idea.