This is an online quiz system built with PHP and MySQL. Users can register, log in, take quizzes, and view their scores.
config.php
connection.php
index.php
insert_questions.php
login.php
logout.php
mainpage.php
quiz.php
register.php
style.css
- PHP (version 7.4 or higher)
- MySQL (version 5.7 or higher)
- A web server (e.g., Apache)
- XAMMP Prefered
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name
-
Create a MySQL database:
CREATE DATABASE quiz_system;
-
Update the database connection details:
- Open
config.php
andconnection.php
. - Update the database host, username, password, and database name if necessary.
- Open
-
Run the database setup script:
- Open your web browser and navigate to
http://localhost/your-repo-name/connection.php
. - This will create the necessary tables and insert sample questions into the database.
- Open your web browser and navigate to
-
Start the PHP server:
php -S localhost:8000
-
Access the application:
- Open your web browser and navigate to
http://localhost:8000/mainpage.php
.
- Open your web browser and navigate to
- config.php: Contains the database connection configuration.
- connection.php: Creates the database and tables, and inserts sample questions.
- index.php: The main page after login, showing the user's quiz scores.
- insert_questions.php: Inserts predefined questions into the database.
- login.php: Handles user login.
- logout.php: Logs out the user and redirects to the main page.
- mainpage.php: The landing page with options to log in or register.
- quiz.php: Displays the quiz questions and handles quiz submission.
- register.php: Handles user registration.
- style.css: Contains the CSS styles for the application.
- User registration and login.
- Quiz with multiple-choice questions.
- Score tracking and display.
- Responsive design.
- Register a new account or log in with an existing account.
- Start the quiz from the main page.
- Answer the questions and submit the quiz.
- View your score and quiz history on the main page.