In the code here, i get an undefined index error using ternary operator.
here is the code :
$phone = isset($_POST['phone']) ? $_POST['phone']
: isset($_GET['phone'])? $_GET['phone'] : null;
But, the posted array has the phone
index as shown in the image(captured from VS Code ).
When I changed it to this,
if(isset($_POST['phone']))$phone = $_POST['phone'];
else $phone = isset($_GET['phone']) ? $_GET['phone'] : null;
The code works fine. is it any error in my code? or is it not supported in ternary operator?