In a table it has a checkbox along with information in each row. When checkboxes are selected, I want it to run php related to the button and within it to call a JS function.
It calls the JS fine, but after that, it does not return to where it was and pick it up again as I still need to use the information within it when the JS has been ran. It's losing the checkboxes that were selected, and jumping out of it, whereas it's needed to keep the checkboxes selected and stay where it was.
Any help would be hugely appreciated as I've spent a long time trying different combinations to do it but not had much luck, to the point where I've even tried calling the js straight from the button and then selecting checkboxes after
'renameFile' is called from
<input type="submit" value="Rename" name="renameFile"/><br>
Then the php
if(isset($_REQUEST['renameFile']))
{
//uses checkboxes from table
if(isset($_POST['checkbox']))
{
$checkedboxes = $_POST['checkbox'];
$count = count($checkedboxes);
if($count == 1)
{
foreach($_POST['checkbox'] as $selected)
{
echo "<script> renameFile(); </script>";
if($rename = $_GET['rename'])
{
echo $rename;
}
}
JavaScript function
function renameFile()
{
var rename = prompt("Please enter a new name", "");
window.location.href="MainHomescreen.php?rename="+rename;
}