I'm trying to add a person's nationality and phone number. So I have a dropdown with country names for nationality and an input box to enter a phone number. When a person choose the nationality (country), the next input Phone should show the country code automatically. So I have to store the person's nationality and also the phone number in the database.
<div class="form-group">
<label>Nationality</label>
<select name="country">
<option value="">Country...</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
.
.
ETC till
<option value="Zimbabwe">Zimbabwe</option>
</select>
</div>
<div class="form-group">
<label for="phone">Phone Number</label><
<input id="phone" name="phone" placeholder="user's number " required="" type="number">
</div>
Do I need to store them in a database table and retrieve or is there a easy way to do it?
You can add to your option tag some data and use it with jquery:
and jQuery: