I'm trying to use a submit button not to submit form data gathered elsewhere on the page, but to post the page to itself and to increment a variable called $selection, which will be used to register the choice in the appropriate database column (page will eventually have two buttons, YES and NO to choose between), and also load the next graphic on the page. Can anyone tell me what's wrong with the code below? I've tried many different iterations of this and am having no success getting the variable to increment when the submit button is clicked. Any help would be greatly appreciated.
<?php
$selection = 0;
$image_folder = "images/";
if (isset($_POST['selection'])) {
....code to update db and load next graphic....
}
echo "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=post>";
echo "<input type=hidden name=selection value=\"" . ($selection + 1) . "\">";
echo "<input type=submit name=subnext value=\"YES\">";
?>