Jump to content

Recommended Posts

Posted

Hello

 

I am working in moodle, and basically trying to add a few features to Quiz Activity as a part of my project.

Since I am novice to moodle and PHP I need some help in PHP coding.

I have built a web page using "Add a resource" in moodle and I am writing the code in its view.php file.

I am trying to load all question ids for a particular quiz in an array and when the page loads for the first time (view.php) I am trying to print the first two values of array as follows: Current Question displayed: array[0] and Next Question displayed: array[1]

So the value at array[0] position should get stored in another temporary table called quiz_currentquestion which has a field (currentquestion).

 

Now on click of Add button, the existing value should get deleted from quiz_currentquestion table and the new value that is the array[1] should be inserted into the table. (i.e. every time there would be just one record in quiz_currentquestion table)

 

Thus on click of ADD button, the string being displayed on screen should get incremented. i.e. Current Question wil nw be :array[1] and Next question would print: array[2].

 

But on click of button, it again executes the entire code and thus the prev value doesn't get stored in the database at all.

 

Is it something to do with submit button, or the logic written in PHP is wrong. Please let me know as I have been trying this thing since last 3 days and am clueless so as to what is the possible reason behind this.

 

Thanks

Ivn

Posted

I did try posting my question on moodle forum in Quiz section but haven't received any reply yet.

But I did get a solution.

Anyway Thanks for replying.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...