coleby58 Posted February 27, 2010 Share Posted February 27, 2010 Hello everyone first let me just say I have not actually started this script I have been confused on how to go about doing this and what would be easy and efficient. I have a webpage that has multiple div boxes, each with a unique id (b1, b2, etc) and the same class ("box"). The idea is that people try to pick the right boxes out of all of them. So I need a script where users can click on ten different boxes (or links in the box) and then the script should check if those are the right boxes then either return with you win or you don't win. My questions are: Can this be done using php? Should there be two scripts? (one that inserts the box value into a form & one that checks the form values with the winning values) Is their a script already made that would work for this? Thank you for checking this out, I’m not asking anyone to do all the hard work for me or hold my hand through it I just simply need to know where to start or get a basic idea of what the script would look like. All help is appreciated, any questions or need more information just ask. Quote Link to comment Share on other sites More sharing options...
alpine Posted February 27, 2010 Share Posted February 27, 2010 I would go for an AJAX aproach, adding picked boxes in a db by a php backend file - if done with pure php you must have each click reloading the page adding up the picked boxes in a session array or to db. Another variant is ofcourse to use javascript adding picked boxes either to a cookie or collecting all div id's in a hidden textfield that is treated by php on submitting the result page. im sure there are many ways of doing it, i would go for the AJAX method. Quote Link to comment Share on other sites More sharing options...
Psycho Posted February 27, 2010 Share Posted February 27, 2010 I think an even easier solution is to just modify how you are selecting the boxes. Instead of using links, which require you to submit the page or use AJAX, you could just have a checkbox in each div. Then the user can select 10 checkboxes and submit their answer. Using the above method you can simply store the correct answer in a session variable and check the response without needing a database. Quote Link to comment Share on other sites More sharing options...
coleby58 Posted February 27, 2010 Author Share Posted February 27, 2010 Thank you both of these helped, I just needed to know where to start researching. I have been using dreamweaver to design this page and I will look into using the spry check boxes and validation features I never even thought of doing it that way. Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.