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"; 

// Query the custom post type to display 
    $args = array('post_type' => 'books'); 
    $query = new WP_Query( $args ); 
    while ( $query->have_posts() ) :  
                 if ( has_post_thumbnail() ):  
            $postid = get_the_ID(); 
    <form action="#" method="post"> 
    <div><?php the_post_thumbnail('thumbnail'); ?><input type="submit" name="submit" value="Vote" /><?php echo " ".$oldcount;?></div> 

<?php endif; endwhile; ?>

hat i want it that count increase and new value be updated on the page too.

plz not the code above is page-template.php assigned to page in wordpress.

when i change <form action="#" method="post"> to <form action=" page-template.php " method="post"> instead of refreshing and updating the current page it instead goes to page-template.php and returns a 404 error also the countis not update basically the if (isset($_POST['submit'])) part is not executed at all. plus it echose button clicked on pageload without clicking any button

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.