0
Good evening how to assign a value to a variable where the value comes from select? however there are in the form varios select, I want to take the value of the selected select.
0
Good evening how to assign a value to a variable where the value comes from select? however there are in the form varios select, I want to take the value of the selected select.
2
If I understand correctly, you want to take values from a select multiple
there’s form
, right?
In this case you should interact with array
in php.
HTML:
<form action="pagina.php" method="GET">
<select multiple name="select_multiple[]">
<option value="Exemplo1">Exemplo1</option>
<option value="Exemplo2">Exemplo2</option>
<option value="Exemplo3">Exemplo3</option>
<option value="Exemplo4">Exemplo4</option>
<option value="Exemplo5">Exemplo5</option>
</select>
</form>
PHP:
$select_multiple = $_GET['select_multiple'];
for ($i=0; $i < count($select_multiple); $i++){
echo $select_multiple[$i];
}
Now if you’re a select
normal, the value is set in the same way as fields text
, checkbox
, radio
, etc..
Thank you very much I was able to run the code
Browser other questions tagged php html
You are not signed in. Login or sign up in order to post.
Are there several selects or a select with several options in your form? The question is not well formulated. I don’t know how they answered it! See in your question
porém existem no formulario varios select
– user60252