I have dropdown list of countries and states and javascript program uses the ID of country to show only state of that county(dynamic dependence ) but i also want to store selected country and state to another database table.the problem is it's storing the ID value into my new table.currently it stores on ID of selected countries and state rather than names. kindly help out.
Here is the code
<label>Select Country</label>
<select class="browser-default custom-select" name="DestionationCountry" id="DestionationCountry">
<option value="">Select Country</option>
<?php
require_once('DbConnection.php');
$countries = mysqli_query($connection, "SELECT * FROM country ORDER BY country");
while ($country = mysqli_fetch_assoc($countries)) {
echo "<option value='" . $country['id'] . "'>" .
$country['country'] . "</option>";}
?>
</select>
The value that you are sending from your form is stored in value attribute of option tag