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 6663105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:27:46+00:00 2026-05-26T02:27:46+00:00

I’m building a quiz web application that is dynamically generated from a database on

  • 0

I’m building a quiz web application that is dynamically generated from a database on my server. I have pretty much implemented all the functionality, the only missing piece is making it capable of providing multiple quizzes. Right now I have to manually write in the code $quiz_id = 1, $quiz_title = "geography" in the quiz.php script for it to run correctly. If I can generate the values for these two variables my quiz.php would work for multiple quiz topics.

So, herein lies my problem: I’d like the user to be able to choose from a list of quiz topics (on the page quizlist.php), click on the link of the quiz they want to take, and then bring them to a page with the quiz questions/choices (on the page quiz.php). Additionally, I’d like to send some values from quizlist.php to quiz.php associated with the specific link the user clicked. I’d like to send the quiz_id and quiz_title to the page quiz.php in order to present the correct set of questions.

I believe there is a way to do this using $_GET or $_POST, as well as using $_SESSION. My questions is which way is better? And how do I do it? I hear $_SESSION is more secure but I’m not sure if I am really worried about this data (quiz_id and quiz_title) being secure.

Currently, here is the code for quizlist.php

<?php
  // Start the session
  require_once('startsession.php');

  // Insert the page header
  $page_title = 'Quiz List';
  require_once('header.php');

  require_once('connectvars.php');

  // Make sure the user is logged in before going any further.
  if (!isset($_SESSION['user_id'])) {
    echo '<p class="login">Please <a href="login.php">log in</a> to access this page.</p>';
    exit();
  }

  // Show the navigation menu
  require_once('navmenu.php');

  // Connect to the database
  $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

  // Determine number of quizes based on title in quiz table
  $query = "SELECT * FROM quiz";
  $data = mysqli_query($dbc, $query);
  // Loop through quiz titles and display links for each
  while ($row = mysqli_fetch_array($data)) {
    echo '<a href="quiz.php">' . $row['title'] . '</a><br />';
  }

  mysqli_close($dbc);

  // Insert the page footer
  require_once('footer.php');
?>

Thanks for the help!

  • 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-05-26T02:27:47+00:00Added an answer on May 26, 2026 at 2:27 am

    Use $_GET.

    First, you’re going to want to change this line

    echo '<a href="quiz.php">' . $row['title'] . '</a><br />';
    

    To something like this:

    echo '<a href="quiz.php?id='.$row['id'].'">' . $row['title'] . '</a><br />';
    

    And then in quiz.php, retrieve the appropriate quiz using $_GET['id'] as your primary key to look it up in the database.

    You should store your quiz title there too (in the db).

    $_GET is appropriate here because you’re just using an ID to determine which quiz to display. There’s no need for confidentiality here. You would use $_POST when you’re submitting form data which alters the database. $_SESSION is useful for storing basic login info and other stuff that must persist across multiple pages for the life of the session, such as wizard forms.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

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.