-1

I'm getting an error when i'm trying to do this delete option. Can someone help me out with this? if(isset($_GET["cart"] :: "delete")) When i'm trying to delete the cart item And the error is Syntax error unexpected T_CONSTANT_ENCAPSED_STRING

  • 1
    it's just a syntex error. check all quotes, points, parenthesis, braces in your code. – Slava May 12 '19 at 08:11

1 Answers1

1

Isset cannot be used on the result of an expression as you are trying to do here. Either use this instead of isset :

<?php
if(NULL!==($_GET['cart']=='delete')){
echo "not null";

}else{
echo "null";
}

?>

OR since you are just trying to see if the users clicked on the delete button try this:

 if (array_key_exists("cart", $_GET)) {



if($_GET['cart']=='delete'){
//your code for deleting
  }
}
tech_ark
  • 26
  • 3