How to create an array meta_key in a specific setup

  forms, meta-key, php, sql, wordpress

I am using WordPress along with a plugin called WPLMS ( A Learn Management System ). The only part of the LMS i am using is the question/quiz functionality.

Due to this, most of the other assets of the LMS are irrelevant to my project, however the way that it creates and uses question banks to create dynamic quizzes is ideal.

With this said, i am wanting to use this functionality but create my own form/page which will create just the quiz.

Whilst looking at the code, the quiz is made up by populating a meta_key (vibe_question_tags) with 3 sections. Below is an example of a key that it has generated.

a:3:{s:4:"tags";a:4:{i:0;a:1:{i:0;s:2:"32";}i:1;a:1:{i:0;s:3:"100";}i:2;a:3:{i:0;s:3:"141";i:1;s:3:"138";i:2;s:3:"142";}i:3;a:1:{i:0;s:3:"137";}}s:7:"numbers";a:4:{i:0;s:1:"4";i:1;s:1:"2";i:2;s:1:"3";i:3;s:1:"1";}s:5:"marks";a:4:{i:0;s:1:"1";i:1;s:1:"1";i:2;s:1:"1";i:3;s:1:"1";}}

It uses tags, which is the question categories selected, numbers which is the number of questions to ask and marks which is how many questions per quiz.

I have been trying to create a form to no avail, that will create a meta_key that will populate like the one shown above does.

Ideally the form would be setup in this way

"Tags" would be a checkbox field, as this will show the categories, multiples can be selected
"numbers" would just be a numerical text box
"marks" would also be a numerical text box

Any help would be massively appreciated

Thanks in advance

Source: Ask PHP

LEAVE A COMMENT