i have a gallery of images withbutton for each when button for a image is click i want the custom field called count be updated with the newcount ...but form method is not working below is my code
PHP Code:
<? if (isset($_POST['submit'])) {
echo " button clicked";
update_field('field_55014',$newcount,$postid);
}
?>
<?php
// Query the custom post type to display
$i=0;
$args = array('post_type' => 'books');
$query = new WP_Query( $args );
while ( $query->have_posts() ) :
$query->the_post();
if ( has_post_thumbnail() ):
$postid = get_the_ID();
$oldcount=get_field('count');
$newcount=$oldcount+1;
$i++;
?>
<form action="#" method="post">
<div><?php the_post_thumbnail('thumbnail'); ?><input type="submit" name="submit" value="Vote" /><?php echo " ".$oldcount;?></div>
</form>
<?php endif; endwhile; ?>