1

I have a weird issue than maybe someone had before.

I have a code to delete a row with an specific id (in my database) in a PHP file:

if(isset($_POST['delete'])){

    $bannerid = $_REQUEST['bannerid'];

    $sql = "DELETE FROM cc_homeslide WHERE id='$bannerid'";
    $conn->query($sql) === TRUE;

    echo "<script>document.location.href='home-slide.php'</script>" ;

} 

EDIT: And this is my form code

<form class='form-delete' action='home-slide-actions.php?bannerid=". $row["id"]."' method='POST'>
 <button class='delete' type='submit' name='delete'>
  <i class='fa fa-trash-o fa-2x'></i>
 </button>
</form>

This code works in Safari and Google Chrome but doesn't work in Mozilla Firefox.

Any idea bout what is going on here?

Tomas Lucena
  • 1,204
  • 1
  • 14
  • 31
  • what does your form look like? It is possible that you have an malformed form/input elements, and Safari/Chrome ignore the error, but Firefox causes the error to not post the form correctly. – Sean Sep 18 '15 at 02:53
  • Try the answer here: http://stackoverflow.com/questions/275092/windows-location-href-not-working-on-firefox3 – Brian DeMilia Sep 18 '15 at 02:53
  • What part of it doesn't work? – Eraph Sep 18 '15 at 03:01
  • Hi, I have added the form code... Brian the query is not working but the script yes, anyway I am going to move everything to window.location – Tomas Lucena Sep 18 '15 at 03:48
  • Can you just give it a shot to use something like '"DELETE FROM cc_homeslide WHERE id='.$bannerid.'";' add those dots in your query, google it, your way, you are just passing the string $bannerid and not the value of variable – Veljko89 Sep 18 '15 at 06:52

0 Answers0