Jump to content

Is This Logic And Thinking Ok?


MoFish

Recommended Posts

Hello.

 

i'm currently trying to make a small poker league for friend and family events, but am a little confused by the logic.

 

after each game; it is going to be nessasary to report the number of players who played, each players name who participated and there positioning.

 

I was thinking the best way to acheive this, would be to have a page with a listbox at the top - containing the numbers 4-6 for the number of players who played.

 

If the user select's 6 from this listbox; another 6 listboxes will be displayed containing the player names (populated from a database).from here the user may select the players name's and positioning's.

 

This could be done by creating 6 individual pages, but moving to PHP is ament to make things work from one location right?

 

im having problems getting my head round if this is the best way to acheive this.

 

could anyone suggest or confirm this is ok? :)

 

thanks, mofish

 

 

Link to comment
https://forums.phpfreaks.com/topic/47475-is-this-logic-and-thinking-ok/
Share on other sites

You can use Javascript or PHP for this.  For javascript, you can generate listboxes like so:

 

function makeBox(boxName, rowCount, optionList) {
     tempList = document.createElement("select");
     tempList.setAttribute("name", boxName);
     tempList.setAttribute("multiple", "true");
     tempList.setAttribute("rows", rowCount);
     for (var i = 0; i < optionList.length; i++) {
          tempOpt = document.createElement("option");
          if (typeof optionList[i].value != "undefined")
               tempOpt.setAttribute("value", optionList[i].value);
          if (typeof optionList[i].selected != "undefined")
               tempOpt.setAttribute("selected", "true");
          tempOpt.innerHTML = optionList[i].label;
          tempList.appendChild(tempOpt);
     }
     return tempList;
}
document.body.appendChild(makeBox("boxname", 5, [{label: "Player Name"}, {label: "Another Player", selected: true}]));

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.