0
validate data
i have questions in an array that comes from mysql and i need to validate each question is checked i manage to check the first question but the rest i don't know how to validate the rest https://code.sololearn.com/wNev65LHt2i3
4 odpowiedzi
+ 1
Is that jQuery code you wrote inside the PHP code block?
I didn't clearly get your intention. It would be nice if you can elaborate further on that.
0
You mean change this?:
foreach ($question as $key => $value){}
0
Ok yes it's jQuery, in the 'foreach' i add 90 questions that come from mysql (the proyect is in my computer i only copied the code to show how it looks) and then the user have to answer all of them and then there's a button that says "End test" with JavaScript what i want is if the user doesn't answer the test and click "End test" an alert runs saying "Answer all the questions" when the jQuery runs and if the test is empty the alert runs but if only 1 question is checked and then click the button the test is sent, only when each question is checked with "a" or "b" should be sent
0
Let me try,
You have a resultset from MySQL which you output as radio buttons (questions and choices).
My idea is to make an array with 90 elements (in JS) and use it to store the selected answer status of each question. You then check the array in case any element were unanswered.
That's a really rough idea though, I'm not sure how it's done in jQuery.