<?php

require_once ("../myconfig.php");

$q1 = "select * from category_";

$res = mysqli_query($db , $q1) or die("Error querying database");



?>


<html>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
  $(document).ready(function() {
    $(".button").click( function(){     
    
         // get the cat id 
         // get the name value
         
       $.ajax({
        url: "test.php",
        data: document.body
       }).done(function() {
          $(this).addClass("done");
       });
    
    
    
    
    
     });
  });
</script>


<meta charset="utf-8"/>

<?php
if (isset($_GET["msg"])){
echo "<h2 style='color:orange'>Thank you! You have successfully suggested a nominee!</h2>";
}


?>



<?php
$counter = 0;
while ( $row = mysqli_fetch_array($res)){

?>

<div>
<form action="send.php" method="post">

<h2 style="color:white"> <span style="color:yellow"> <?php echo ++$counter; ?>.</span> <?php echo $row['name'] ; ?> </h2>
<input class="catid" type="hidden" value="<?php echo $row['id'];  ?>" name="cat_id"/>
<input id="n_<?php  echo $row['id']?>" type="text" placeholder="Enter the nominee" name="name"/>&nbsp; &nbsp;
<input type="button" value="Nominate" class="button"/>
</form>


</div>
<hr/>

<?php


}

?>


</html>