|
Answer» So I am playing around with PHP and what better WAY to learn it than to make a game, however ... I have some questions regarding the user interface options:
Looking online I see multiple ways for implementing user controls through web pages with PHP, but there are pros and cons to each one and havent found the best option yet that would work for the game I am making.
Method #1 - Forms, where a user enters data or checks a box etc and clicks submit. ( Cons = requires data entry + submit ) ( Pros = works well with database data entry etc )
Method #2 - Hyperlinks pointed to PHP scripts, contained within tables which compose the buttons for the GUI ( Cons = I think it is going to be a problem with database data entry unless form data can be passed within the PHP script without user having to click submit ) ( Pros = Requires just 1 click to trigger event and no submit required )
While forms are the better method, I want the interface to be a simple single-click of predetermined options vs selecting an option and then selecting to submit.
While Hyperlinks to PHP scripts allow for a single-click to execute a routine, it will likely be a problem when implemented in a client/server environment later on when data is passed to a mySQL database to record game status etc, so why build it to operate locally and then have to drastically reconstruct it later to work in a client/server environment.
While my knowledge of HTML is pretty good, when it comes to CGI and Forms etc I generally have to do research and when stumped ask questions. It would be NICE to be able to use forms and have a single-click to trigger an event, but I am not sure if this is possible or not since the basic design of forms is for data entry and then submit it vs instantly passing an INSTRUCTION in a single-click which is what I really want to make the controls as simplistic as possible.jQuery.
an exceedingly simple example.
Basically you can issue asynchronous requests through client-side javascript, which can perform any required request. The above for example requests a QUOTE through an existing PHP file every few moments, but it could also be invoked by a button or other control.
eg. In your case it would be trivial to submit a form when a combobox changed, or to do so dynamically and actually display the results in a separate div without reloading the page or loading a new page- the combobox's event handler could issue a asynchronous POST request of that changed item and show the appropriate result in a separate div through DOM.Thanks BC for pointing me in correct direction.
Found some more examples here: http://www.w3schools.com/jquery/jquery_examples.asp
|