Skip to main content

Voting System using PHP/MySQLi with Source Code


The Voting System web application using PHP/MySQLi is a project that serves as the automated voting system of an organization or school. This system works like the common manual system of election voting system whereas this system must be populated by the list of the positions, candidates, and voters. This system can help a certain organization or school to minimize the voting time duration because aside they can provide the voters an online platform to vote, the system will automatically count the votes for each candidate. The system has 2 sides of the user interface which are the administrator and voters side. The admin user is in charge to populate and manage the data of the system and the voter side which is where the voters will choose their candidate and submit their votes.


  • Vote preview
  • Multiple votes
  • Result tally via Horizontal Barchart
  • Print voting results in PDF
  • Changeable order of positions to show in the ballot
  • CRUD voters
  • CRUD candidates
  • CRUD positions


  • AdminLTE


  1. Download the source code using the Download button below.
  2. Extract the downloaded file to your localhost folder ex. htdocs for XAMMP.
  3. Import the included .sql file located in db folder which is the database of the system. If you have no idea how to import, please refer to my tutorial on How import .sql file to restore MySQL database.
  4. After a successful import, open the extracted folder and open conn.php in both the includes folder and in the admin/includes folder. Edit the database name in the connection depending on the name of the database you created in importing the included .sql file.

How to Use

  1. First login as administrator by adding /admin/ in the URL. You should be redirected to the admin login page.
  2. Add the important data such as positions, candidates, and voters.
  3. Change the title of the election by clicking the Election Title menu.
  4. Rearrange the order of positions depending on the desired order to show in the ballot using the Ballot Position menu.

Use this admin credential:

Username: nurhodelta
Password: password

And for the voter's username, use the auto-generated voter's id.

That's it. If you find any bugs or errors or you have any suggestions, comments, or reactions, feel free to comment below or message me.

Happy Coding :)

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Submitted byYusuf (not verified)on Thu, 05/24/2018 - 19:42

hey Neo saw your system is good but i fail to login into voters because i fails to identify votersid. need your help
Submitted byBasheer Haadi (not verified)on Sun, 01/13/2019 - 13:45

am very surprise and impressed when i go through this project. Good job (please i want to learn more from you.)
Submitted byfamo (not verified)on Sat, 07/06/2019 - 06:53

Haven't seen the code yet
Submitted byAbdulkadir (not verified)on Fri, 11/01/2019 - 19:53

I CAN'T PRINT THE RESULT OF THE ELECTION COULD YOU HELP ME PLEASE Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in C:\xampp\htdocs\VotingSystem_PHP\votesystem\tcpdf\tcpdf.php on line 17778 TCPDF ERROR: Some data has already been output, can't send PDF file
Submitted byscientistpaajoe (not verified)on Mon, 12/16/2019 - 05:56

easy code is fast
Submitted byali shokouhi (not verified)on Wed, 12/18/2019 - 17:03

i need voting system with php
very usefull

Submitted byDexter David (not verified)on Wed, 04/28/2021 - 15:47

I'm having an error in the print button particularly in "each" code, do you have any suggestions or workaround? Thank you
Submitted byNsubuga moses (not verified)on Fri, 07/16/2021 - 20:11

Hello, am getting this error when trying to log in as admin. Please help Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\votesystem\admin\includes\conn.php on line 3 Connection failed: Access denied for user 'root'@'localhost' (using password: NO)
Submitted byKOFI12 (not verified)on Fri, 08/06/2021 - 19:36

Submitted byNickterrence (not verified)on Tue, 10/05/2021 - 01:36

Cant login with this user details Nurhodelta password

Add new comment