I am trying to implement an Online testing. I found two ways to check user selected answers.
way1
<div class="qContainer" index="0">
Who has socred 100 centuries in Internationa cricker?
<ul>
<li> <input type="radio" value"Sachin">Sachin</input>
<li> <input type="radio" value"Don">Don Bradman</input>
<li> <input type="radio" value"Steve">Steve waugh</input>
<li> <input type="radio" value"Saeed">Saeed</input>
</ul>
</div>
In this method, I am storing answer in the question itsef[index=0]
. But user can cheat this.
way2
send farm data to the server through ajax post method.
$.ajax({
url: "testResult.php",
type:"POST",
data: $("#formID").serialize()
});
With this methond, Url gets changed with the selected answer. [i.e answers are posted through post method] And check result in the php page against db data and display the result to the user.
Please let me know is there any other ways to achieve this better than this two. And what are the drawbacks in these methods?