I have a PHP submit form, within that form I have a PHP image gallery that displays images from a folder. (I have a dropdown to select images from different folders).
When I click on an image from the gallery the path to that image is entered into an input field so it can be linked to the other information when submitted.
My problem is when I choose a different image gallery folder from the dropdown it submits the form. I understand why it does this, but am unsure how to change the way it uses PHP to choose different folders to JS/JQ so there is no need for a submit or refresh.
Here is the relevant code...
<script>
function change(){
document.getElementById("myfolders").submit();
}
</script>
$subF = $_POST['otherFolders'];
<form id="myfolders" method="post">
<select name="otherFolders" onchange="change()">
<option selected="selected">Other Galleries</option>
<?php
$otherFolders = $dirs2;
foreach($otherFolders as $item){
?>
<option value="<?php echo $item; ?>"><?php echo $item; ?></option>
<?php
}
?>
</select>
Thanks for any help