Answer the question
In order to leave comments, you need to log in
Assignment to a variable in a ternary operator. Notes?
I assign a variable like this
$demo = ($_POST["demo"]) ? $demo : " ";
. As a result, Notice is given : Undefined index: demo in sendMail.php on line 10
How to do it right, provided that there may not be a demo in the Post?
Answer the question
In order to leave comments, you need to log in
You should probably assign the value $_POST["demo"] to $demo. Then like this:
$demo = isset($_POST["demo"]) ? $_POST["demo"] : " ";
$demo = $_POST["demo"] ?? " ";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question