<form name="valform" onsubmit="handleSubmit(event)">
Name: <input type="text" name="name">
<br/>
Card Type:
<select name="cardType">
<option value="visa">Visa</option>
<option value="mastercard">MasterCard</option>
<option value="discover">Discover</option>
<option value="amex">Amex</option>
<option value="diners">Diners Club</option>
</select>
<br/>
<button type="submit">Submit</button>
</form>
function handleSubmit(e) {
e.preventDefault();
const formData = new FormData(e.target);
const values = Object.fromEntries(formData);
console.log(values); // { name: '...', cardType: '...' }
}