vistavision Posted May 6, 2014 Share Posted May 6, 2014 Hi all, I hope you can help me further with this problem. I want to build a quiz/votematch website like this one:http://bit.ly/1kGUGJ6 I want to ask about 20 questions and record all clicked items, so I can use it to match it after the last question. All questions are like this: <div class="stelling" id="stelling4618"> <p>Question 1</p> <h2>The question here.</h2> <a address="true" href="#/stelling/2" class="big botshadow button agree">Eens</a> <a address="true" href="#/stelling/2" class="big botshadow button neutral">Geen van beide</a> <a address="true" href="#/stelling/2" class="big botshadow button disagree">Oneens</a> <a address="true" href="#/stelling/2" class="medium button skip">Sla deze vraag over</a> </div> So if a user click on the first link, <a>eens</a>, I want to push this text to an array with php. After question 20 I want to show all clicked items and match it with my database values. How can I do this? Please help me, I really need this... Thanks so much!! Kind regards, Mark Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted May 6, 2014 Share Posted May 6, 2014 Will all the questions be displayed at once? Or will the user answer one question, reload the page, answer another question, reload the page, etc.? If all the questions will be displayed at the same time, you could build a single HTML form which passes all the responses to PHP at the end. If the questions will be asked one at a time, you could display a form with the first question. The form would submit to a PHP script for processing. The script would display the next question while passing the previous responsive using hidden form variables or maybe a PHP Session variable. Then just repeat until all the questions have been answered. Quote Link to comment Share on other sites More sharing options...
vistavision Posted May 6, 2014 Author Share Posted May 6, 2014 Hi CyberRobot, Thanks for the quick response. All the questions are on the same page at once and are shown seperate with a javascript animation. So I html form is possible, only I want to style it like the example: http://bit.ly/1kGUGJ6 So I need to use html links instead of radio buttons. With Radio buttons it works, but I don't know how I can manage it with links like in the example. I've tried something like add an active state when the link is pressed, but I can't figure it out. I'm pretty new to php so I really want to learn this. Thanks so much for helping me!! kind regards, Mark Quote Link to comment Share on other sites More sharing options...
vistavision Posted May 6, 2014 Author Share Posted May 6, 2014 (edited) So please, what do you guys advise: 1: Create a form post with radiobuttons and try to style it like on the example 2: Use a a link attribute and send the data to php some other way?I think option 2 is the best because radiobuttons aren't supposed to be styled like the example and links are more flexible. I can make the one clicked active like this (normal is active): <a class="animatie knop active" href="#">Normal</a> <a class="animatie knop" href="#">Bad</a> <a class="animatie knop" href="#">Good</a> So now I need a php code [when class=active post data to array/session]. Is this something that could work? Please, can anybody help me with this? Thanks so much!!! Edited May 6, 2014 by vistavision 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.