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

    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="1506157611" >
    <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?

    <p><b>Multiple Choice </b> Which one of these living creatures is a mammal?</p>
    <ol class="alpha">
    <input type="radio" name="which-is-mammal"  value="a"/>crocodile
    <input type="radio" name="which-is-mammal"  value="b"/>ant
    <input type="radio" name="which-is-mammal"  value="c"/>whale
    <input type="radio" name="which-is-mammal"  value="d"/>penguin
  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.
  4. End the question set render->mcEnd();
    This code
    401 render.php SID

    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>
    <h3> Your Score -  Guest </h3> <div class="giant green">0 / 1</div><br>
    <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