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
Submitted byMegsand (not verified)on Sun, 02/27/2022 - 03:29

Hello, am having the same problem, how did you manage to log in? Kindly assist, [email protected]
Submitted byMegsand (not verified)on Sun, 02/27/2022 - 03:32

I cannot log in using the username and password. it brings error message. Kindly assist.
Submitted byReagan Ahimbisibwe (not verified)on Tue, 03/29/2022 - 19:55

I really take this chance to appreciate you for your work to put up this system. It is good and works efficiently well. To any one downloading it, you might need to update the tcpd to the current version to allow printing.
Submitted byHassan juma (not verified)on Mon, 06/27/2022 - 02:19

In reply to by Reagan Ahimbisibwe (not verified)

Hi Reagan, Thank you for the useful advice. Just one question. Do I have to download it separately and plug it into my code files, replacing the old one?Or how is one to go about it?
Submitted byjuma hassan (not verified)on Mon, 06/27/2022 - 02:02

Hi Nurhodelta, Thank you for this amazing project. It has been really helpful in my class project. However, I am having issues printing the votes. I get a deprecated and warning error message from the following lines: Warning: chr() expects parameter 1 to be int, string given in C:\wamp64\www\votesystem\tcpdf\include\tcpdf_fonts.php on line 1671 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in C:\wamp64\www\votesystem\tcpdf\tcpdf.php on line 16542 Warning: Cannot modify header information - headers already sent by (output started at C:\wamp64\www\votesystem\tcpdf\tcpdf.php:16542) in C:\wamp64\www\votesystem\tcpdf\tcpdf.php on line 7624 Kindly assist me rectify this error. I am very greatful. Best regards, Hassan
Submitted byjuma hassan (not verified)on Mon, 06/27/2022 - 02:22

Using wammp server, you can downgrade your php version if it is higher. i was using version 7.4.26 and I faced deprecation problems. So i downgraded to PHP version 5.6.40 and it works smooth like a baby.
Submitted byDannion (not verified)on Mon, 10/10/2022 - 01:30

Nurhodelta, how do I import multiple voters details via excel or cvs to the source code
Submitted byCLama (not verified)on Thu, 11/10/2022 - 11:19

Thank you hope i can edit the code and customize it, and admin login is not working please where is the password hash available

Add new comment