Select multiple

Asked

Viewed 81 times

1

I’m having a problem getting the results of a select multiple, because it does not come with the whole name when it comes to a compound name example.

<form action="/action_page.php">
<select name="cars" multiple>
  <option value="volvo">Volvo teste</option>
  <option value="saab">Saab verifica</option>
  <option value="opel">Opel mais</option>
  <option value="audi">Audi</option>
</select>
<input type="submit">
</form>

But when I get the return response it appears only:

"Volvo", "Saab", "Opel" e "Audi"

The compound part of the name is not appearing. It was to appear in my result if I select "Volvo Test" and not just "Volvo".

  • When you submit the form, only the value of options.

2 answers

1


When you send one select you don’t get your name, only the property value of the options selected as the sam well mentioned in the comment.

See you later and welcome to Stack Overflow BR

  • Hello, thanks for the reply, in case I am sending via $_POST to another form, it comes from an SQL where fills my select multiple correctly, but when sending to the other form it comes Cut only the first word that appears. <select name="carrier[]" id="carrier" class=" form-control" Multiple="Multiple"> <? php echo $Oper;? > </select>

  • Thanks friends, I checked the problem after you spoke, it was right here when I get SQL $Oper = $Oper . " <option value=" . $exec->Fields['operator']->Value . " >" . utf8_encode($exec->Fields['operator']->Value) . " </option>"; I added a ' after . " <option value=" ' and before ' >" valeu

1

I put it in your attribute value of the HTML the full name, because this attribute is responsible for the return and not what you wrote for display on the page. For sure what is returning to you in this code above is what is written inside the value.

<form action="/action_page.php">
  <select name="cars" multiple>
    <option value="Volvo teste">Volvo teste</option>
    <option value="Saab verifica">Saab verifica</option>
    <option value="Opel mais">Opel mais</option>
    <option value="Audi">Audi</option>
  </select>
  <input type="submit">
</form>

I hope I’ve helped!

  • Thank you very much,

Browser other questions tagged

You are not signed in. Login or sign up in order to post.