Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
Select multiple options with datalist with Javascript and PHP

Context: I'm retrieving an array with several tickers from stocks (such as AAPL, FB, TSLA,etc) from PHP and now I'd like the user to select multiple stocks from this datalist, however, I'm not sure how to do exactly that. I've tried using multiple, but it doesn't seem to be working. I am being able to see the scrollable list of the 500+ tickers from PHP (connected to MySQL), but I can only choose one at a time and not several of them.

HTML and Javascript

<div class="loss">
          <div class="row">
            <div class="col">
              <div id="data">
                <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
                  <input style="background: rgba(255,255,255,0.5);border-radius: 10px; border: none;  text-align: center;" list="brow">
                  <datalist id="brow">
                    <form id="myForm">
                      <select id="selectStock">
                        <option></option>
                      </select>
                    </form>
                  </datalist>
                  <input class="button1" type="submit" name="submit" id="submit"></input>
                </form>

               
                <script>
                 
                  var select = document.getElementById("selectStock");
                  var options = <?php echo json_encode($tickerArray) ?>; 

                  for (var i = 0; i < options.length; i++) {
                    var opt = options[i]; 
                    var el = document.createElement("option");
                    el.innerHTML = opt; 
                    el.value = opt; 
                    select.appendChild(el); /
                  }


 
                </script>
              </div>
            </div>
          </div>

Any help is very welcome!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!