1

I have a dropdown user list (which is generated by database info) and I'm looking for a way to load some extra information from the database every time I choose a different user from the dropdown menu. (without reloading the page)

<select class="form-control" id="Users" name="Users">
      <option value="0" selected> - </option>
<?php
$query=$MMM->query("SELECT * FROM `users` WHERE user_status = 1 ORDER BY user_id ASC");
while ($data = $MMM->fetch($query)) {
?>
      <option value="<?php echo $data['user_id']; ?>"> <?php echo $data['user_name']; ?> </option>
<?php
}
?>
</select>

And here is the table I'm trying to "reload" every time I chose a different user from the dropdown menu

<table class="table table-bordered table-striped table-xs">
      <thead>
          <tr>
              <th class="text-center">Username</th>
              <th class="text-center">Name</th>
              <th class="text-center">Email</th>
              <th class="text-center">City</th>
          </tr>
      </thead>
      <tbody>
          User Info will go here
      </tbody>
</table>

Is it possible to do achieve this with PHP?

3
  • You're looking for AJAX. Commented Jun 12, 2019 at 22:15
  • I am looking for something similar, where we select the first dropdown list and the remaining things will change according this selection. My understanding it is only possible using JQuery script. I keep you informed :-). Commented May 27, 2020 at 11:32
  • I found this one https://stackoverflow.com/questions/42803193/how-to-create-3-depended-dropdown-list-using-php-ajax-jquery and I believe will sort your issue. Commented May 27, 2020 at 11:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.