If you left an exercise unfinished in a previous lab, feel free to
go back and finish it.
Write a page with a form to enter a user, and insert it into the
database with PDO, in the user table.
Make it possible to select the user's country from a drop-down menu during registration
Add an "Other" option, which lets the user (in the same form) enter a country if theirs is not in the list:
<input type="text" placeholder="Other..." name="otherCountry" />
In this case, the country will be inserted into the database and then associated with the user during registration. (A hint).
If you want to display the "other" field only when the user has chosen "Other" in the drop-down menu, you can use JavaScript to hide or show the text field accordingly
<script>
function refresh() {
const otherCountryInput = document.getElementById('otherCountry');
otherCountryInput.style.display =
(document.getElementById('country').value === 'other') ? 'inline' : 'none';
}
document.getElementById('country').addEventListener('change', refresh);
refresh();
</script>