Content / help / exercise .. concise-view << previous next >>

Course Exercise Example

Multiple Choice HTML markup syntax

The new multiple choice questions can be inserted into any page using the PHP function calls below. See the bottom of this page for the rendered result of the sample exercise.
The following HTML produces a multiple choice exercise. This HTML is produced by PHP functions so that any future developments will take effect across all old content.
Note: Gap fill exercises and multiple choice exercise, submit back to the same page so that the DB updates are handled within the same page's PHP code.

Multiple Choice HTML produced by PHP functions

Use these PHP functions to generate multiple choice questions.
The form start and end should also work if they contain a mixture of question types. Eg: The same form can contain a mixture of gap fills and multiple choice questions
  1. Start the MC question or questions
    This code
     $render->MCstart(); 

    Produces this HTML - QUESTION FORM START
    <form class="gapfill" method="post"  id="exercise"  action = ""> 
    
    <input class="hidden" name="check-help-exercise" id="check-help-exercise" value="1506093540" >
    <input class="hidden" name="course" value="help" >
    <input class="hidden" name="exercise" value="exercise" >
  2. Insert a multiple choice question
    This function requires an array defining the multiple choice question.
    This array data can also be stored on the questions database.

    Example Multiple Choice Question array

    This code
    questionMultiple Choice Which one of these living creatures is a mammal?
    options
    0crocodile
    1ant
    2whale
    3penguin
    namewhich-is-mammal
    correctwhale
     $render->MCquestion($mcq.); 

    Produces this HTML - ONE MULTIPLE CHOICE QUESTION
    <p><b>Multiple Choice </b> Which one of these living creatures is a mammal?</p>
    <ol class="alpha">
    <li>
    <input type="radio" name="which-is-mammal"  value="a"/>crocodile
    <li>
    <input type="radio" name="which-is-mammal"  value="b"/>ant
    <li>
    <input type="radio" name="which-is-mammal"  value="c"/>whale
    <li>
    <input type="radio" name="which-is-mammal"  value="d"/>penguin
    </ol>
  3. Insert a gap fill question into the page.
    Gap fill questions will be given a default sequence number, but you may sequence the gapfill question yourself so that when the sequence is broken by inserting more questions, the submitted results still remain without a broken sequence.
     $render->wordGap($data.); 
  4. End the question set render->mcEnd();
    This code
     $render->MCend(); 

    Produces this HTML - END OF QUESTION FORM
    <input type="hidden"  name="gapfill-qcount" id="gapfill-qcount" value="1" >
    
    <button type="submit" class="xsubmit-ready"> Submit </button>
    </form>
    <h3> Your Score -  Guest </h3> <div class="giant green">0 / 1</div><br>
    <nav>
    <ul class="nav nav-pills">
     <li> <a onclick="showMyGapfillGrade('help','','1');" >  Your attempts for this course </a>
    <li> <a class="big fat orange"  href="/courses" target="_blank" >  Grade Reports </a></ul></nav>

Here's the Actual Rendered HTML Exercise Form

Multiple Choice Which one of these living creatures is a mammal?

  1. crocodile
  2. ant
  3. whale
  4. penguin
What day of the week follows Tuesday? _________

Your Score - Guest

0 / 1



Rendered code end above




iBiscuits LOGO