I'm trying to use the isset() function to see if a variable is set, and if so, to perform a function, like so:
<?php
//if user cancels
if (isset($cancelphoto)){
//delete file...
$ok = unlink($photo);
if ($ok === false){
die("<br>Failed to delete ");
echo $photo;
}
}
?>
and I have two buttons set up like this:
<?php
if (is_readable($photo)){
echo "<input type=\"submit\" value=\"Add image\" onClick='opener.showProgress(); document.uploadurl_form.submit()'>";
echo "<input type=\"button\" name=\"cancelphoto\" value=\"Cancel\">";
}
?>
...but nothing happens... no error message, and the file does not get deleted. What am I doing wrong?