use dropdown value as a button

Viewed 29

hey so i am trying to make so that every username stored in my database is shown on the dropbox and when i click on any of the username it takes me to example.com/selected_username

heres current code im working with

 <select class="btn btn-primary dropdown-toggle" name="options_app">
                              <?php
                              $username = $_SESSION['username'];

                              $result = mysqli_query($link, "SELECT * FROM `application` WHERE `owner` = '$username'");

                              $rows = array();
                              while ($r = mysqli_fetch_assoc($result)) {
                                $rows[] = $r;
                              }

                              foreach ($rows as $row) {

                                $appname = $row['name'];
                              ?>
                                <option><?php echo $appname; ?></option>
                              <?php
                              }
                              ?>
                            </select>

for this i have to click a button


                        <div class="mb-3">
                          <button class="btn btn-primary" name="donow" type="submit">submit</button>
                        </div>

but i want to make it so i click on any dropdown option and it does what "submit" button does directly

0 Answers
Related