<?php
include("databaseconnect.php");
if(isset($_POST['submitvotes'])) {
$vote = $_REQUEST['submitvotes'];
$sql = "UPDATE `candidates` SET votescasted = votescasted + 1 WHERE `id` = '$vote'";
$qry = mysqli_query($connect, $sql);
if ($qry){
header("location: onlinevotingsystem.php?ViewResults");
}
}
mysqli_close($connect);
?>
Am making online voting system using the code above but the problem is that it's only incrementing the votes by one. Is there any way I can stop voting several times (vote only once).
Am looking for solid ideas to also be able to save voters details and who they casted votes to.