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

138
Views
how do i update inputs when select box is changed

so i have something like this

<?php
  ini_set('display_errors', 1);
  ini_set('display_startup_errors', 1);
  error_reporting(E_ALL);

  $groups[] = [];
  require_once('./config.php');
  $sql = "SELECT * FROM groups";
  $result = $conn->query($sql);
  if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
      $groups[] = [
        "clip_name" => $row["clip_name"],
        $row['clip_name'] => [
          "member1" => $row["member1"],
          "member2" => $row["member2"],
          "member3" => $row["member3"],
          "member4" => $row["member4"],
          "member5" => $row["member5"],
          "notes" => $row["notes"]
        ]
      ];
    }

  } else {
    echo "0 results";
  }
?>

<body>
  <form action="test.php" method="post">
    <select>
      <?php
        foreach ($groups as $group) {
          echo "<option value='" . $group['clip_name'] . "'>" . $group['clip_name'] . "</option>";
        }
      ?>
    </select>
    <input type="text" name="member1" placeholder="Member 1">
    <input type="text" name="member2" placeholder="Member 2">
    <input type="text" name="member3" placeholder="Member 3">
    <input type="text" name="member4" placeholder="Member 4">
    <input type="text" name="member5" placeholder="Member 5">
    <input type="text" name="notes" placeholder="Notes">
    <input type="submit" name="submit" value="Submit">
  </form>
</body>
</html>

and i want it so when the select box is changed it updates the inputs. may i ask how i would do this? say i have this in my db

| RED 2 | bob | rivca | riv | coconut | fred | bipod needed |

so if the select box is set for "RED 2" it shows the inputs as the later values

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!