Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9215377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:11:28+00:00 2026-06-18T02:11:28+00:00

Here is a demo DEMO In demo, select an assessment, submit it, then when

  • 0

Here is a demo DEMO

In demo, select an assessment, submit it, then when student and question drop down menu appear, click the other submit button. You will see an undefined variable appear. What I am trying to do there is echo the assessment name, data and time from the Assessment drop down menu. But how can this be done?

Below is relevant code:

   function PickSession() 
        {
            //ASSESSMENT DROP DOWN MENU:

            //Get data from database
            $sessionquery = "
                SELECT s.SessionId, SessionName, SessionDate, SessionTime, SessionActive, Complete
                FROM Session s
                INNER JOIN Session_Complete sc ON sc.SessionId = s.SessionId
                WHERE
                (Complete = ?)
                ORDER BY SessionName 
                ";
            $complete = 1;

            global $mysqli;
            $sessionqrystmt=$mysqli->prepare($sessionquery);
            // You only need to call bind_param once
            $sessionqrystmt->bind_param("i",$complete);//it doesn't recognse $userid
            // get result and assign variables (prefix with db)
            $sessionqrystmt->execute(); 
            $sessionqrystmt->bind_result($dbSessionId,$dbSessionName,$dbSessionDate,$dbSessionTime, $dbSessionActive, $dbComplete);
            $sessionqrystmt->store_result();

            ?>

            <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post"> 
                   <p>
                <strong>Asessments:</strong>
                <select name="session" id="sessionsDrop">
                    <option value="">Please Select</option>
                    <?php
                        while ( $sessionqrystmt->fetch() ) {
                            $sv = $dbSessionId;
                            if(isset($_POST["session"]) && $sv == $_POST["session"]) 
                                echo "<option selected='selected' value='$sv'>" . $dbSessionName . " - " . date('d-m-Y',strtotime($dbSessionDate)) . " - " . date('H:i',strtotime($dbSessionTime)) . "</option>" . PHP_EOL;
                            else
                                echo "<option value='$sv'>" . $dbSessionName . " - " . date('d-m-Y',strtotime($dbSessionDate)) . " - " . date('H:i',strtotime($dbSessionTime)) . "</option>" . PHP_EOL;
                        }
                    ?>
                </select>
                </p>
                <input id="sessionSubmit" type="submit" value="Submit Assessments" name="sessionSubmit" />
            </form>
        <?php
        }

    --------------------------------------------------------------------

        function SessionIsSubmitted()
        {
                if(isset($_POST["session"]) && empty($_POST["session"])) // We picked the "Please select" option
                { ?>

                        Please Select an Assessment

                <?php 
                    return false;
                }
            else if(!isset($_POST["session"]))
            {
                return false;
            }
            else // All is ok
            {
                return true;
            }
            return false;

        }

    --------------------------------------------------------------------

        function ShowAssessment()
        {   

        //STUDENT AND QUESTION DROP DOWN MENU GO HERE
        //button - name='answerSubmit' goes here

        }

    --------------------------------------------------------------------

        function StudentAnswersIsSubmitted()
        {

        if(!isset($_POST["answerSubmit"]))
            {
                return false;
            }
            else // All is ok
            {
                return true;
            }
            return false;

        }

    --------------------------------------------------------------------

        function StudentAnswers()
        {

        echo $dbSessionName . " - " . $dbSessionDate . " " . $dbSessionTime;

        }

        ?>

Below is functions structure:

    <?php


            PickSession(); // Show the thing to pick session
            if(SessionIsSubmitted()) // When session is picked
            {
              ShowAssessment(); // Show students and questions information
              if(StudentAnswersIsSubmitted()) // Student Answers button is submitted
                {
                  StudentAnswers();
                }

            }



    ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:11:29+00:00Added an answer on June 18, 2026 at 2:11 am

    you can’t print one selected element by putting array variable $dbSessionName. All assessment are getting stored in this array and you want to print the selected assessment by putting the array variable. Try to print only that element of array which has been selected.
    Do like this:

    <select name="session[]" id="sessionsDrop">
    if (isset($_POST['Submit']) == 1) {
    
        $session_name = $_POST['session'];
            echo $session;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is an extension of this question , here you can see a demo
I have 3 drop down (combo boxes) or select lists on a page. It
Please see demo here: http://jsfiddle.net/mA6qm/1/ (expand console) Why aren't events being sent or received
Please see the demo here: http://jsfiddle.net/Freewind/Vkp4U/ The html: <div class=outer> <div class=x>x</div> <div class=y>y</div>
Consider the following example: ( live demo here ) HTML: <div class=board> <div class=row>
Im having a big headcache with a header design: Here the demo: http://jsfiddle.net/uGECm/ The
I'm trying to build a simple grid of div s: ( live demo here
Here is the DEMO HTML CODE as <div id=me></div> <a id=ok href=>OK</a> jquery code:
Here is what I want to do: class demo(object): def a(self): pass def b(self,
![enter image description here][1]On my two demo and screenshot, you can understand that so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.