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
Use $_GET
.
First, you're going to want to change this line
echo '' . $row['title'] . '
';
To something like this:
echo '' . $row['title'] . '
';
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.