Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6126915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:26:17+00:00 2026-05-23T16:26:17+00:00

I have the following code: <table border=0 width=100%><tbody> <tr> <th style=text-align: center;><?php echo $text[‘PLAYERS’];

  • 0

I have the following code:

  <table border="0" width="100%"><tbody>
     <tr>
        <th style="text-align: center;"><?php echo $text['PLAYERS']; ?></th>
     </tr>
     <tr>
        <td>
        <select name="order" size="1" onchange="sortPlayers(this)">
           <option value="name"><?php echo $text['NAME']; ?></option>
           <option value="age"><?php echo $text['AGE']; ?></option>
           <option value="ss"><?php echo $text['SS']; ?></option>
           <option value="experience"><?php echo $text['EXPERIENCE']; ?></option>
           <option value="leadership"><?php echo $text['LEADERSHIP']; ?></option>            
           <option value="weight"><?php echo $text['WEIGHT']; ?></option>             
           <option value="height"><?php echo $text['HEIGHT']; ?></option>       
           <option value="stamina"><?php echo $text['STAMINA']; ?></option>             
           <option value="strength"><?php echo $text['STRENGTH']; ?></option>             
           <option value="breakthroughs"><?php echo $text['BREAKTHROUGHS']; ?></option>
           <option value="tackling"><?php echo $text['TACKLING']; ?></option>
           <option value="handling"><?php echo $text['HANDLING']; ?></option>             
           <option value="speed"><?php echo $text['SPEED']; ?></option>
           <option value="kicking"><?php echo $text['KICKING']; ?></option>
        </select>
        </td>
     </tr>   
     <?php foreach ($result as $player) { ?>
     <tr>
        <td style="text-align: left;"><?php echo $player['male'] . ' ' . $player['name']; ?></td>
     </tr>
     <?php } ?>
  </tbody></table>

It generates a list with every users players in a online game.
I want that when user selects something from the dropdown menu, players are sorted by what has been selected (strength, speed, etc.).
I have a function to get the players: get_players ($ tid, $ sort).
$tid = user id
$sort = sorting criteria (speed, kicking, etc.).

What is JavaScript code to get what is selected in that input and change the variable $result depending on the selection in that input, but without refreshing the page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:26:18+00:00Added an answer on May 23, 2026 at 4:26 pm

    If I understand the desire correctly, you want the viewer to be able to select an option (name, age, ss, experience, etc…) and then have different sorted results display depending upon which attribute was selected and you want to do this without refreshing the page.

    From a design point of view, you have two ways to go. You can include in the initial page (in a Javascript data structure) all the possible data for all the selections. Then, it’s just a matter of some javascript code to fetch the right piece of data from the data structure, sort it and insert it into the DOM to display.

    Or, if you don’t pre-include all the data, you will have to make an ajax call to fetch the desired data, sort it and then insert it into the DOM. The PHP you show in your code right now looks like it’s only including the player’s name.

    Which way to go really depends upon the scale of the data. If it’s manageable (from a speed of generating the page and browser memory consumption point of view) to just include all the data in the original page, that is easier to code. But, you have to look at your worst case of max number of players, max number of attributes you support. If that’s not manageable, then you will need to support an ajax call that can return JSON data for a given attribute that has been selected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: <%-- other tags --%> <table> <tr width=100%> <td width=130
I have the following code: CSS #main { width:100%; height:120px; border:solid 1px #efefef; }
I have the following code: <div class=rep_tb0 style=width: 100%> <div class=rep_tr0 style=width: 100%> <div
I have to following code: http://www.nomorepasting.com/getpaste.php?pasteid=22987 If PHPSESSID is not already in the table
I have the following html code: <table> <tr> <td> <div id=fixmywidth style=position:relative; height:30px;> <div
I have table with following structure: <table style= margin-top: 10px; border: 1px wheat solid;
I have the following html files: <html> <head> <style type=text/css> .table-striped { padding: 0;
I have the following test-code: CREATE TABLE #Foo (Foo int) INSERT INTO #Foo SELECT
I have the following code: $sql = INSERT INTO table VALUES ('', ...); $result
I have the following code <table cellpadding=2 cellspacing=2> <tr> <td>Factory:</td> <td> <asp:TextBox ID=txtFactory runat=server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.