How to make a selection list for users of my website

1

I am something new in the world of programming and I have the following question in the following context:

I am developing a web page where one can enter with your user account and make publications, comment on other users' publications, etc. The question that arises is:

How can I make a selection bar so that my users can select which country / region they belong to or in which country / region they look for, for example: a house, employment, whatever to add to the registration form? my website and how to declare it in the user database (I think I would have to do it again) and on the page?

Thanks in advance

    
asked by marianorz 16.05.2018 в 00:45
source

3 answers

1

You can use the select tag:

<select id="opciones">
    <option value="valor1"> Opcion 1</option>
    <option value ="valor2"> Opcion 2</option>
    <option value="valor3"> Opcion 3</option>
</select>

And to get the value of the option that the user chose with javascript is done like this:

var valor = document.getElementById("opciones").value;
    
answered by 16.05.2018 в 01:01
1

Increase the 'multiple' Attribute to a select.

<select id="opciones" multiple >
    <option value="valor1">Opcion 1</option>
    <option value="valor2">Opcion 2</option>
    <option value="valor3">Opcion 3</option>
    <option value="valor3">Opcion 4</option>
    <option value="valor3">Opcion 5</option>
</select>

more information at HTML multiple Attribute

    
answered by 16.05.2018 в 01:26
0

You can use the html Select tag and add the optgroup tag to categorize the options.

I hope you serve

<select>
  <option value="0" style="display:none">Selecciones una opción</option>
  <optgroup label="España">
    <option value="1">Islas Canarias</option>
    <option value="2">Peninsula</option>
    <option value="3">Ceuta y Melilla</option>
  </optgroup>
  <optgroup label="Estados Unidos">
    <option value="4">New Yor</option>
    <option value="5">New Jersey</option>
    <option value="5">Massachusetts</option>
  </optgroup>
</select>
    
answered by 16.05.2018 в 03:49