<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <div class="col-md-12 column">
        <p>
            <?php
            $message = $this->session->userdata('message');
            $this->session->unset_userdata('message');
            if ($message) {
                echo $message;
            }
            ?>
        </p>

        <h4>Question option:</h4>

        <?php // echo validation_errors(); ?>

        <div role="tabpanel">

            <!-- Nav tabs -->
            <ul class="nav nav-tabs" role="tablist">
                <li role="presentation" class="<?php
                if ($question_info->question_type == 1) {
                    echo 'active';
                }
                ?>"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Mutiple Choice</a></li>
                <li role="presentation" class="<?php
                if ($question_info->question_type == 2) {
                    echo 'active';
                }
                ?>" ><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">True False</a></li>
                <li role="presentation" class="<?php
                if ($question_info->question_type == 3) {
                    echo 'active';
                }
                ?>" ><a href="#desc" aria-controls="desc" role="tab" data-toggle="tab">Descriptive Question</a></li>
                <li role="presentation" class="<?php
                if ($question_info->question_type == 4) {
                    echo 'active';
                }
                ?>" ><a href="#fill" aria-controls="fill" role="tab" data-toggle="tab">Fill the Blank</a></li>

            </ul>

            <!-- Tab panes -->
            <div class="tab-content">

                <div role="tabpanel" class="tab-pane active col-sm-12 " id="home">
                    <?php if ($question_info->question_type == 1) { ?>
                        <div class="form-group col-sm-12"> 
                            <form class="cmxform" id="formID2" action="<?php echo base_url(); ?>super_admin_quiz/update_question/<?php echo $question_info->question_id; ?>" method="post"  name="question_edit_form" enctype="multipart/form-data" >


                                <div class="col-sm-4">
                                    <div >
                                        <br/>
                                        <label for="question_details">Question</label><span class="required"> * </span>
                                        <input type="text" data-errormessage-value-missing="Question  is required!" class="form-control validate[required]" id="first_name" name="question_details" value="<?php
                                        if (set_value('question_details')) {
                                            echo set_value('question_details');
                                        } elseif ($question_info->question_type == 1) {
                                            echo $question_info->question_details;
                                        }
                                        ?>" required placeholder="Your question" >
                                        <input type="hidden"  name="question_id" value="<?php echo $question_info->question_id; ?>" >

                                        <input type="hidden" class="form-control" id="first_name" name="question_type" value="1"  >
                                        <div class="form-group  required" ><?php echo form_error('question'); ?></div>
                                    </div> 

                                    <div >
                                        <label for="quiz_id">Select Quiz</label><span class="required"> * </span>
                                        <select data-errormessage-value-missing="Please select a quiz!" class="form-control validate[required]" id="quiz_iddd"  name="quiz_id" required >
                                            <option value="">--Select Quiz--</option>
                                            <?php
                                            foreach ($all_quiz as $v_quiz) {
                                                ?>
                                                <option value="<?php echo $v_quiz->quiz_id; ?>"><?php echo $v_quiz->quiz_name; ?></option>
                                            <?php } ?>

                                        </select>
                                    </div>
                                    <div class="form-group  required" ><?php echo form_error('quiz_id'); ?></div>
                                    <br/>
                                    <div >
                                        <label for="topic_id">Select Topic</label><span class="required"> * </span>
                                        <select data-errormessage-value-missing="Please select a topic!" class="form-control validate[required]" id="topic_iddd"  name="topic_id" onchange="addGroupType(this.value);"  style="float:left; " required>
                                            <option value="" >--Select Topic--</option>
                                            <?php
                                            foreach ($all_topic as $v_topic) {
                                                ?>
                                                <option value="<?php echo $v_topic->topic_id; ?>"><?php echo $v_topic->topic_name; ?></option>
                                            <?php } ?>
                                            <option value="other">Other</option>
                                        </select>
                                    </div>

                                    <script>
                                        function addGroupType(topics) {
                                            if (topics === 'other') {
                                                document.getElementById('other_topics').innerHTML = "<br/><label for='quiz_topics'>Other Topic</label><span class='required'> * </span><input type='text' data-errormessage-value-missing='Group type is required!' class='form-control validate[required]' id='other_topic' name='other_topic' value='<?php echo set_value('other_topic'); ?>'placeholder='Enter other topic' onblur='checkGroupType(this.value);' >";
                                                document.getElementById('message1').innerHTML = "<p style='color:red;'></p>";
                                            } else {
                                                document.getElementById('other_topics').innerHTML = "";
                                                document.getElementById('message1').innerHTML = "";
                                            }
                                        }

                                        function checkGroupType(groupOtherType)
                                        {
                                            if (groupOtherType != '') {
                                                document.getElementById('message1').innerHTML = '<p style="color:red;"></p>';
                                            } else if (groupOtherType == '') {
                                                document.getElementById('message1').innerHTML = '<p style="color:red;">Please Enter topic</p>';
                                            }
                                        }
                                    </script>

                                    <div id="other_topics" ></div>
                                    <div  id="message1"><?php echo form_error('topic_id'); ?></div>
                                    <div class="form-group col-sm-12 required" ><?php echo form_error('topic_id'); ?></div>
                                    <br/>
                                    <br/>
                                    <br/>
                                    <div >

                                        <label for="points_per_answer">Marks of this question</label><span class="required"> * </span>
                                        <input type="number" data-errormessage-value-missing="Mark is required!"

                                               class="form-control validate[required]" id="marks3" name="points_per_answer" value="<?php
                                               if (set_value('points_per_answer')) {
                                                   echo set_value('points_per_answer');
                                               } elseif ($question_info->question_type == 1) {
                                                   echo $question_info->points_per_answer;
                                               }
                                               ?>" placeholder="marks" onchange = "checkNegative(this.value, 'marks3', 'marks_err3');" required >

                                        <div class="form-group  required" id="marks_err3" ><?php echo form_error('points_per_answer'); ?></div>
                                    </div>
                                    <br/>
                                    <br/>
                                    <div>

                                        <label for="time_limit">Time Limit(In minute)</label><span class="required"> * </span>
                                        <input type="number" data-errormessage-value-missing="Time limit required!"

                                               class="form-control validate[required]"  id="time_limit3" name="time_limit" value="<?php
                                               if (set_value('time_limit')) {
                                                   echo set_value('time_limit');
                                               } elseif ($question_info->question_type == 1) {
                                                   echo $question_info->time_limit;
                                               }
                                               ?>"  onchange = "checkNegative(this.value, 'time_limit3', 'time_err3');" placeholder="time Limit" >
                                        <div class="form-group  required" id="time_err3" ><?php echo form_error('time_limit'); ?></div>
                                    </div>
                                </div>
                                <br/>
                                <br/>

                                <div class="col-sm-8">
                                    <h4>Answers:</h4>
                                    <div class="form-group  required" ><?php echo form_error('option'); ?></div>
                                    <div class="form-group col-sm-6">
                                        <label for="option"><h3>(A)</h3></label>
                                        <input class="showCorrect mc_forminput" type="radio" id="status" name="status[]" value="0" <?php
                                        if ($option_info[0]->question_option_status == 1) {
                                            echo 'checked';
                                        }
                                        ?>  id="a1">
                                        <label for="a1" class="">This answer option is correct</label>
                                        <input class="showCorrect mc_forminput" type="hidden" name="option_id[]" value="<?php echo $option_info[0]->question_option_id; ?>" id="a1">
                                        <textarea name="option[]" data-errormessage-value-missing="Please provide an option!" class="form-control validate[required]"  ><?php
                                            if (set_value('option[0]')) {
                                                echo set_value('option[0]');
                                            } elseif ($question_info->question_type == 1) {
                                                echo $option_info[0]->question_option;
                                            }
                                            ?></textarea>
                                    </div>

                                    <div class="form-group col-sm-6">
                                        <label for="option"><h3>(B)</h3></label>
                                        <input class="showCorrect mc_forminput" type="radio" id="status" name="status[]" value="1" <?php
                                        if ($option_info[1]->question_option_status == 1) {
                                            echo 'checked';
                                        }
                                        ?> id="a1">
                                        <label for="a1" class="">This answer option is correct</label>
                                        <input class="showCorrect mc_forminput" type="hidden" name="option_id[]" value="<?php echo $option_info[1]->question_option_id; ?>" id="a1">
                                        <textarea name="option[]" data-errormessage-value-missing="Please provide an option!" class="form-control validate[required]"  ><?php
                                            if (set_value('option[1]')) {
                                                echo set_value('option[1]');
                                            } elseif ($question_info->question_type == 1) {
                                                echo $option_info[1]->question_option;
                                            }
                                            ?></textarea>
                                    </div>

                                    <div class="form-group col-sm-6">
                                        <label for="option"><h3>(C)</h3></label>
                                        <input class="showCorrect mc_forminput" type="radio" id="status" name="status[]" value="2" <?php
                                        if ($option_info[2]->question_option_status == 1) {
                                            echo 'checked';
                                        }
                                        ?> id="a1">
                                        <label for="a1" class="">This answer option is correct</label>
                                        <input class="showCorrect mc_forminput" type="hidden" name="option_id[]" value="<?php echo $option_info[2]->question_option_id; ?>" id="a1">
                                        <textarea name="option[]" data-errormessage-value-missing="Please provide an option!" class="form-control validate[required]" ><?php
                                            if (set_value('option[2]')) {
                                                echo set_value('option[2]');
                                            } elseif ($question_info->question_type == 1) {
                                                echo $option_info[2]->question_option;
                                            }
                                            ?></textarea>
                                    </div>
                                    <div class="form-group col-sm-6">
                                        <label for="option"><h3>(D)</h3></label>
                                        <input class="showCorrect mc_forminput" type="radio" id="status" name="status[]" value="3" <?php
                                        if ($option_info[3]->question_option_status == 1) {
                                            echo 'checked';
                                        }
                                        ?> id="a1">
                                        <label for="a1" class="">This answer option is correct</label>
                                        <input class="showCorrect mc_forminput" type="hidden" name="option_id[]" value="<?php echo $option_info[3]->question_option_id; ?>" id="a1">
                                        <textarea name="option[]" data-errormessage-value-missing="Please provide an option!" class="form-control validate[required]" ><?php
                                            if (set_value('option[3]')) {
                                                echo set_value('option[3]');
                                            } elseif ($question_info->question_type == 1) {
                                                echo $option_info[3]->question_option;
                                            }
                                            ?></textarea>
                                    </div>
                                    <br/>

                                </div>
                                <div class="checkbox col-sm-12" >
                                    <div class="checkbox col-sm-3" >
                                        <button type="submit" id="submit" class="btn btn-success" >Submit</button>
                                        <button type="reset" class="btn btn-info">Reset</button>
                                    </div>
                                </div>

                            </form>
                        </div>
                    </div>

                <?php } ?>


                <div role="tabpanel" class="tab-pane col-sm-12" id="profile">
                    <?php if ($question_info->question_type == 2) { ?>
                        <div class="form-group col-sm-12">  
                            <form class="cmxform" id="formID5" action="<?php echo base_url(); ?>super_admin_quiz/update_question/<?php echo $question_info->question_id; ?>" method="post" name="edit_Form" enctype="multipart/form-data" >
                                <div class="col-sm-5">

                                    <div >
                                        <br/>
                                        <label for="question_details">Question</label><span class="required"> * </span>
                                        <input type="text" data-errormessage-value-missing="Question  is required!" class="form-control validate[required]" id="first_name" name="question_details" value="<?php
                                        if (set_value('question_details')) {
                                            echo set_value('question_details');
                                        } elseif ($question_info->question_type == 2) {
                                            echo $question_info->question_details;
                                        }
                                        ?>"  placeholder="Your question" >
                                        <div class="form-group required" ><?php echo form_error('question'); ?></div>
                                        <input type="hidden" class="form-control" id="first_name" name="question_type" value="2"  >
                                        <input type="hidden"  name="question_id" value="<?php echo $question_info->question_id; ?>" >
                                    </div> 

                                    <div >
                                        <label for="quiz_id">Select Quiz</label><span class="required"> * </span>
                                        <select data-errormessage-value-missing="Please select a quiz!" class="form-control validate[required]" id="quiz_id"  name="quiz_id" >
                                            <option value="">--Select Quiz--</option>
                                            <?php
                                            foreach ($all_quiz as $v_quiz) {
                                                ?>
                                                <option value="<?php echo $v_quiz->quiz_id; ?>"><?php echo $v_quiz->quiz_name; ?></option>
                                            <?php } ?>

                                        </select>
                                    </div>
                                    <div class="form-group  required" ><?php echo form_error('quiz_id'); ?></div>
                                    <br/>



                                    <br/>
                                    <div >
                                        <label for="topic_id">Select Topic</label><span class="required"> * </span>
                                        <select data-errormessage-value-missing="Please select a topic!" class="form-control validate[required]"  name="topic_id" id="topic_id" onchange="addquesType(this.value);"  style="float:left; " >
                                            <option value="">--Select Topic--</option>
                                            <?php
                                            foreach ($all_topic as $v_topic) {
                                                ?>
                                                <option value="<?php echo $v_topic->topic_id; ?>"><?php echo $v_topic->topic_name; ?></option>
                                            <?php } ?>
                                            <option value="other">Other</option>
                                        </select>
                                    </div>

                                    <script>
                                        function addquesType(topicses) {
                                            if (topicses === 'other') {
                                                document.getElementById('other_topicses').innerHTML = "<label for='quiz_topics'>Other Topic</label><span class='required'> * </span><input type='text' data-errormessage-value-missing='Group type is required!' class='form-control validate[required]' id='other_topic' name='other_topic' value='<?php echo set_value('other_topic'); ?>'placeholder='Enter other topic' onblur='checkQuesType(this.value);' >";
                                                document.getElementById('message2').innerHTML = "<p style='color:red;'></p>";
                                            } else {
                                                document.getElementById('other_topicses').innerHTML = "";
                                                document.getElementById('message2').innerHTML = "";
                                            }
                                        }

                                        function checkQuesType(groupOtherType)
                                        {
                                            if (groupOtherType != '') {
                                                document.getElementById('message2').innerHTML = '<p style="color:red;"></p>';
                                            } else if (groupOtherType == '') {
                                                document.getElementById('message2').innerHTML = '<p style="color:red;">Please Enter topic</p>';
                                            }
                                        }
                                    </script>

                                    <div id="other_topicses" ></div>
                                    <div  id="message2"><?php echo form_error('quiz_topics'); ?></div>
                                    <div class="form-group col-sm-12 required" ><?php echo form_error('quiz_topics'); ?></div>

                                    <div class="form-group  required" ><?php echo form_error('topic_id'); ?></div>
                                    <br/>
                                    <br/>
                                    <br/>
                                    <div >

                                        <label for="points_per_answer">Marks of this question</label><span class="required"> * </span>
                                        <input type="number" data-errormessage-value-missing="Mark  is required!" class="form-control validate[required]" id="marks2" name="points_per_answer" value="<?php
                                        if (set_value('points_per_answer')) {
                                            echo set_value('points_per_answer');
                                        } elseif ($question_info->question_type == 2) {
                                            echo $question_info->points_per_answer;
                                        }
                                        ?>"  onchange = "checkNegative(this.value, 'marks2', 'marks_err2');" placeholder="marks" >
                                        <div class="form-group  required" id="marks_err2" ><?php echo form_error('points_per_answer'); ?></div>

                                    </div>
                                    <br/>
                                    <br/>
                                    <div >

                                        <label for="time_limit">Time Limit(in minute)</label><span class="required"> * </span>
                                        <input type="number" data-errormessage-value-missing="Time is required!" class="form-control validate[required]" id="time_limit2" name="time_limit" value="<?php
                                        if (set_value('time_limit')) {
                                            echo set_value('time_limit');
                                        } elseif ($question_info->question_type == 2) {
                                            echo $question_info->time_limit;
                                        }
                                        ?>"  onchange = "checkNegative(this.value, 'time_limit2', 'time_err2');" placeholder="time Limit" >
                                        <div class="form-group  required" id="time_err2" ><?php echo form_error('time_limit'); ?></div>

                                    </div>
                                </div>
                                <br/>
                                <br/>
                                <div class="col-sm-7">
                                    <h4>Answers:</h4>
                                    <div class="form-group col-sm-6">
                                        <label for="option"><h3>(A). True  </h3></label>
                                        <input class="showCorrect mc_forminput" type="hidden" name="option[]" value="True" id="a1">
                                        <input class="showCorrect mc_forminput" type="hidden" name="option_id[]" value="<?php echo $option_info[0]->question_option_id; ?>" id="a1">
                                        <input class="showCorrect mc_forminput" type="radio" name="status[]" value="0" <?php
                                        if ($option_info[0]->question_option_status == 1) {
                                            echo 'checked';
                                        }
                                        ?> id="a1">
                                        <label for="a1" class=""> This answer option is correct</label>

                                    </div>
                                    <div class="form-group col-sm-6">
                                        <label for="option"><h3>(B). False </h3></label>
                                        <input class="showCorrect mc_forminput" type="hidden" name="option[]" value="False" id="a1">
                                        <input class="showCorrect mc_forminput" type="hidden" name="option_id[]" value="<?php echo $option_info[1]->question_option_id; ?>" id="a1">
                                        <input class="showCorrect mc_forminput" type="radio" name="status[]" <?php
                                        if ($option_info[1]->question_option_status == 1) {
                                            echo 'checked';
                                        }
                                        ?> value="1" id="a1">
                                        <label for="a1" class=""> This answer option is correct</label>

                                    </div>

                                    <script type="text/javascript">
                                        jQuery(document).ready(function ($) {
                                            $('#tabs').tab();
                                        });
                                    </script>    

                                </div>
                                <br/>
                                <br/>
                                <br/>
                                <div class="checkbox col-sm-12" >
                                    <div class="checkbox col-sm-3" >
                                        <button type="submit" id="submit" class="btn btn-success" >Submit</button>
                                        <button type="reset" class="btn btn-info">Reset</button>
                                    </div>
                                </div>
                            </form>

                        </div>
                    </div>

                <?php } ?>

                <div role="tabpanel" class="tab-pane col-sm-12 " id="desc">
                    <?php if ($question_info->question_type == 3) { ?>
                        <div class="form-group col-sm-12"> 
                            <form id="formID6" action="<?php echo base_url(); ?>super_admin_quiz/update_question/<?php echo $question_info->question_id; ?>" method="post" name="desc_Form" enctype="multipart/form-data" >

                                <div class="col-sm-5">
                                    <div >
                                        <br/>
                                        <label for="question_details">Question</label><span class="required"> * </span>
                                        <input type="text" data-errormessage-value-missing="Question is required!" class="form-control validate[required]" id="first_name" name="question_details" value="<?php
                                        if (set_value('question_details')) {
                                            echo set_value('question_details');
                                        } elseif ($question_info->question_type == 3) {
                                            echo $question_info->question_details;
                                        }
                                        ?>"  placeholder="Your question" >
                                        <input type="hidden" class="form-control" id="question_type" name="question_type" value="3"  >
                                        <input type="hidden"  name="question_id" value="<?php echo $question_info->question_id; ?>" >
                                        <div class="form-group  required" ><?php echo form_error('question'); ?></div>
                                    </div> 
                                    <br/>

                                    <div >
                                        <label for="quiz_id">Select Quiz</label><span class="required"> * </span>
                                        <select data-errormessage-value-missing="Please select a quiz!" class="form-control validate[required]" id="quiz_id"  name="quiz_id" >
                                            <option value="">--Select Quiz--</option>
                                            <?php
                                            foreach ($all_quiz as $v_quiz) {
                                                ?>
                                                <option value="<?php echo $v_quiz->quiz_id; ?>"><?php echo $v_quiz->quiz_name; ?></option>
                                            <?php } ?>

                                        </select>
                                    </div>
                                    <div class="form-group  required" ><?php echo form_error('quiz_id'); ?></div>
                                    <br/>

                                    <div >
                                        <label for="topic_id">Select Topic</label><span class="required"> * </span>
                                        <select data-errormessage-value-missing="Please select a topic!" class="form-control validate[required]" id="quiz_topics"  name="topic_id" onchange="adddesType(this.value);"  style="float:left; " >
                                            <option value="">--Select Topic--</option>
                                            <?php
                                            foreach ($all_topic as $v_topic) {
                                                ?>
                                                <option value="<?php echo $v_topic->topic_id; ?>"><?php echo $v_topic->topic_name; ?></option>
                                            <?php } ?>
                                            <option value="other">Other</option>
                                        </select>
                                    </div>

                                    <script>
                                        function adddesType(topics) {
                                            if (topics === 'other') {
                                                document.getElementById('other_topicsdes').innerHTML = "<br/><label for='quiz_topics'>Other Topic</label><span class='required'> * </span><input type='text' data-errormessage-value-missing='Group type is required!' class='form-control validate[required]' id='other_topic' name='other_topic' value='<?php echo set_value('other_topic'); ?>'placeholder='Enter other topic' onblur='checkGroupType(this.value);' >";
                                                document.getElementById('message3').innerHTML = "<p style='color:red;'></p>";
                                            } else {
                                                document.getElementById('other_topicsdes').innerHTML = "";
                                                document.getElementById('message3').innerHTML = "";
                                            }
                                        }

                                        function checkGroupType(groupOtherType)
                                        {
                                            if (groupOtherType != '') {
                                                document.getElementById('message3').innerHTML = '<p style="color:red;"></p>';
                                            } else if (groupOtherType == '') {
                                                document.getElementById('message3').innerHTML = '<p style="color:red;">Please Enter topic</p>';
                                            }
                                        }
                                    </script>

                                    <div id="other_topicsdes" ></div>
                                    <div  id="message3"><?php echo form_error('quiz_topics'); ?></div>
                                    <!--<div class="form-group col-sm-12 required" ><?php // echo form_error('quiz_topics');                  ?></div>-->


                                    <div class="form-group  required" ><?php echo form_error('topic_id'); ?></div>
                                    <br/>
                                    <br/>
                                    <div >

                                        <label for="points_per_answer">Marks of this question</label><span class="required"> * </span>
                                        <input type="number" data-errormessage-value-missing="Mark is required!" class="form-control validate[required]" id="marks" name="points_per_answer" value="<?php
                                        if (set_value('points_per_answer')) {
                                            echo set_value('points_per_answer');
                                        } elseif ($question_info->question_type == 3) {
                                            echo $question_info->points_per_answer;
                                        }
                                        ?>"   onchange = "checkNegative(this.value, 'marks', 'marks_err');" placeholder="marks" >

                                        <div class="form-group  required" id="marks_err" ><?php echo form_error('points_per_answer'); ?></div>
                                    </div>
                                    <br/>
                                    <br/>
                                    <div>

                                        <label for="time_limit">Time Limit (In minute)</label><span class="required"> * </span>
                                        <input type="number" data-errormessage-value-missing="Time is required!" class="form-control validate[required]" id="time_limit" name="time_limit" value="<?php
                                        if (set_value('time_limit')) {
                                            echo set_value('time_limit');
                                        } elseif ($question_info->question_type == 3) {
                                            echo $question_info->time_limit;
                                        }
                                        ?>"  onchange = "checkNegative(this.value, 'time_limit', 'time_err');" placeholder="time Limit" >
                                        <div class="form-group  required" id="time_err"><?php echo form_error('time_limit'); ?></div>
                                    </div>
                                </div>
                                <br/>
                                <br/>

                                <div class="col-sm-7">
                                    <!--<h4>Answer of the Question:</h4>-->
                                    <div class="form-group col-sm-12">
                                        <label for="desc_answer"><h3>Answer of the Question:</h3></label>
                                        <textarea name="desc_answer" data-errormessage-value-missing="Answer is required!" class="form-control validate[required]" rows="7"  ><?php
                                            if (set_value('desc_answer')) {
                                                echo set_value('desc_answer');
                                            } elseif ($question_info->question_type == 3) {
                                                echo $question_info->question_detail_answer;
                                            }
                                            ?></textarea>
                                    </div>
                                    <br/>
                                </div>
                                <div class="checkbox col-sm-12" >
                                    <div class="checkbox col-sm-3" >
                                        <button type="submit" id="submit" class="btn btn-success" >Submit</button>
                                        <button type="reset" class="btn btn-info">Reset</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>    

                <?php } ?> 

                <div role="tabpanel" class="tab-pane col-sm-12 " id="fill">
                    <?php if ($question_info->question_type == 4) { ?>
                        <div class="form-group col-sm-12"> 
                            <form id="formID7" action="<?php echo base_url(); ?>super_admin_quiz/update_question/<?php echo $question_info->question_id; ?>" method="post" name="fill_Form" enctype="multipart/form-data" >
                                <div class="col-sm-5">
                                    <div >
                                        <br/>
                                        <label for="question_details">Question</label><span class="required"> * </span>
                                        <input type="text" data-errormessage-value-missing="Question is required!" class="form-control validate[required]" id="first_name" name="question_details" value="<?php
                                        if (set_value('question_details')) {
                                            echo set_value('question_details');
                                        } elseif ($question_info->question_type == 4) {
                                            echo $question_info->question_details;
                                        }
                                        ?>"  placeholder="Your question" >
                                        <input type="hidden" class="form-control" id="question_type" name="question_type" value="4"  >
                                        <input type="hidden"  name="question_id" value="<?php echo $question_info->question_id; ?>" >
                                        <div class="form-group  required" >Put an _ (uderscore) at the place of blank word.</div>
                                        <div class="form-group  required" ><?php echo form_error('question'); ?></div>
                                    </div> 
                                    <br/>

                                    <div >
                                        <label for="quiz_id">Select Quiz</label><span class="required"> * </span>
                                        <select data-errormessage-value-missing="Please select a quiz!" class="form-control validate[required]" id="quiz_id"  name="quiz_id" >
                                            <option value="">--Select Quiz--</option>
                                            <?php
                                            foreach ($all_quiz as $v_quiz) {
                                                ?>
                                                <option value="<?php echo $v_quiz->quiz_id; ?>"><?php echo $v_quiz->quiz_name; ?></option>
                                            <?php } ?>

                                        </select>
                                    </div>
                                    <div class="form-group  required" ><?php echo form_error('quiz_id'); ?></div>
                                    <br/>

                                    <div >
                                        <label for="topic_id">Select Topic</label><span class="required"> * </span>
                                        <select data-errormessage-value-missing="Please select a topic!" class="form-control validate[required]" id="quiz_topics"  name="topic_id" onchange="addfillType(this.value);"  style="float:left; " >
                                            <option value="">--Select Topic--</option>
                                            <?php
                                            foreach ($all_topic as $v_topic) {
                                                ?>
                                                <option value="<?php echo $v_topic->topic_id; ?>"><?php echo $v_topic->topic_name; ?></option>
                                            <?php } ?>
                                            <option value="other">Other</option>
                                        </select>
                                    </div>

                                    <script>
                                        function addfillType(topics) {
                                            //                        alert('fill');
                                            if (topics === 'other') {
                                                document.getElementById('other_topicsfill').innerHTML = "<br/><label for='quiz_topics'>Other Topic</label><span class='required'> * </span><input type='text' data-errormessage-value-missing='Group type is required!' class='form-control validate[required]' id='other_topic' name='other_topic' value='<?php echo set_value('other_topic'); ?>'placeholder='Enter other topic' onblur='checkfillType(this.value);' >";
                                                document.getElementById('message4').innerHTML = "<p style='color:red;'></p>";
                                            } else {
                                                document.getElementById('other_topicsfill').innerHTML = "";
                                                document.getElementById('message4').innerHTML = "";
                                            }
                                        }

                                        function checkfillType(groupOtherType)
                                        {
                                            if (groupOtherType != '') {
                                                document.getElementById('message4').innerHTML = '<p style="color:red;"></p>';
                                            } else if (groupOtherType == '') {
                                                document.getElementById('message4').innerHTML = '<p style="color:red;">Please Enter topic</p>';
                                            }
                                        }
                                    </script>

                                    <div id="other_topicsfill" ></div>
                                    <div  id="message4"><?php echo form_error('quiz_topics'); ?></div>

                                    <div class="form-group  required" ><?php echo form_error('topic_id'); ?></div>
                                    <br/>
                                    <br/>
                                    <div>

                                        <label for="points_per_answer">Marks of this question</label><span class="required"> * </span>
                                        <input type="number" data-errormessage-value-missing="Mark is required!" class="form-control validate[required]"  id="marks4" name="points_per_answer" value="<?php
                                        if (set_value('points_per_answer')) {
                                            echo set_value('points_per_answer');
                                        } elseif ($question_info->question_type == 4) {
                                            echo $question_info->points_per_answer;
                                        }
                                        ?>"   onchange = "checkNegative(this.value, 'marks4', 'marks_err4');" placeholder="marks" >

                                        <div class="form-group  required" id="marks_err4" ><?php echo form_error('points_per_answer'); ?></div>
                                    </div>
                                    <br/>
                                    <br/>
                                    <div>

                                        <label for="time_limit">Time Limit</label><span class="required"> * </span>
                                        <input type="number" data-errormessage-value-missing="Time is required!" class="form-control validate[required]" id="time_limit4" name="time_limit" value="<?php
                                        if (set_value('time_limit')) {
                                            echo set_value('time_limit');
                                        } elseif ($question_info->question_type == 4) {
                                            echo $question_info->time_limit;
                                        }
                                        ?>"  onchange = "checkNegative(this.value, 'time_limit4', 'time_err4');" placeholder="time Limit" >
                                        <div class="form-group  required" id="time_err4"><?php echo form_error('time_limit'); ?></div>
                                    </div>
                                </div>
                                <br/>
                                <br/>

                                <div class="col-sm-7">
                                    <!--<h4>Answer of the Question:</h4>-->
                                    <div class="form-group col-sm-12">
                                        <label for="fill_answer"><h3>Answer of the Question:</h3></label>
                                        <textarea name="fill_answer" data-errormessage-value-missing="Answer is required!" class="form-control validate[required]" rows="2"  ><?php
                                            if (set_value('fill_answer')) {
                                                echo set_value('fill_answer');
                                            } elseif ($question_info->question_type == 4) {
                                                echo $question_info->question_detail_answer;
                                            }
                                            ?></textarea>
                                    </div>

                                    <br/>
                                </div>
                                <div class="checkbox col-sm-12" >
                                    <div class="checkbox col-sm-5" >
                                        <button type="submit" id="submit" class="btn btn-success" >Submit</button>
                                        <button type="reset" class="btn btn-info">Reset</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>

                <?php } ?> 

                <script type="text/javascript">
                    document.forms['question_edit_form'].elements['quiz_iddd'].value = '<?php
                if (set_value('quiz_id')) {
                    echo set_value('quiz_id');
                } else {
                    echo $question_info->quiz_id;
                };
                ?>';
                    document.forms['question_edit_form'].elements['topic_iddd'].value = '<?php
                if (set_value('topic_id')) {
                    echo set_value('topic_id');
                } else {
                    echo $question_info->topic_id;
                };
                ?>';


                </script>
                <script type="text/javascript">
                    document.forms['edit_Form'].elements['topic_id'].value = '<?php
                if (set_value('topic_id')) {
                    echo set_value('topic_id');
                } else {
                    echo $question_info->topic_id;
                };
                ?>';
                    document.forms['edit_Form'].elements['quiz_id'].value = '<?php
                if (set_value('quiz_id')) {
                    echo set_value('quiz_id');
                } else {
                    echo $question_info->quiz_id;
                };
                ?>';

                </script>

                <script type="text/javascript">
                    document.forms['desc_Form'].elements['topic_id'].value = '<?php
                if (set_value('topic_id')) {
                    echo set_value('topic_id');
                } else {
                    echo $question_info->topic_id;
                };
                ?>';
                    document.forms['desc_Form'].elements['quiz_id'].value = '<?php
                if (set_value('quiz_id')) {
                    echo set_value('quiz_id');
                } else {
                    echo $question_info->quiz_id;
                };
                ?>';

                </script>


                <script type="text/javascript">
                    document.forms['fill_Form'].elements['topic_id'].value = '<?php
                if (set_value('topic_id')) {
                    echo set_value('topic_id');
                } else {
                    echo $question_info->topic_id;
                };
                ?>';
                    document.forms['fill_Form'].elements['quiz_id'].value = '<?php
                if (set_value('quiz_id')) {
                    echo set_value('quiz_id');
                } else {
                    echo $question_info->quiz_id;
                };
                ?>';

                </script>

            </div>
        </div>
    </div>    
</div>
<script>

    function checkNegative(value, input, err) {
//      alert ('first alert');
        if (value < 0) {
//        alert ('you cant put negative value');
            document.getElementById(err).innerHTML = "<p style='color:red;'>you cant put negative value</p>";
            document.getElementById(input).value = "";

        } else {
            document.getElementById(err).innerHTML = "";
        }
    }

</script>  