title: How can I display and update PHP objects in HTML?
body: <p>I know similar questions have been asked and answered before, but I see so many different answers that I'm wondering if somebody can give an answer for my specific issue.</p>
  
  <p>I wish to display a list of Soccer players on a webpage, which are retrieved from a database. Each player needs a drop-down box, allowing him to be picked/unpicked/subbed in the squad. When this happens, the database needs to be updated, along with the webpage, to show his new position and to store the information. I know how to update the database with PHP, but the only way that I know how to do the webpage part, is with Javascript. I thought I'd cracked it when I fathomed out how to use 'onchange' to call a Javascript function, but that's brought up another problem. If I pass the ID of the player and his new position to the function, I'm unable to update the PHP object from inside the Javascript, because there's no way (that I know of) for the PHP code to read the passed variables. What I'd want to do inside the function, is take the passed ID parameter, use that to match up the player in the PHP array, then update him.</p>
  
  <p>The only solutions that I can think of are either</p>
  
  <p>A) Don't use PHP at all in the HTML page and instead pass the information to the page with json_encode... presumably then read it into a Javascript array/function. Then when the function updates the player, call an PHP file (can parameters be passed into the file this way?).</p>
  
  <p>B) Somehow convert the parameters in the Javascript function to PHP. Is this possible?</p>
  
  <p>C) Find another way to respond to the down-down box that calls PHP instead of Javascript. Again, not sure if this is possible.</p>
  
  <p>D) Call a PHP function from within the Javascript function. Again, don't think it's possible?</p>
  
  <p>Is there a simpler solution or do I go with one of the above?</p>