Both of the following should be legal:
$Status = ($_POST['status'] == "Inactive" ? "Inactive" : "Active");
$stmt->bind_param("s", $Status);
$stmt->bind_param("s", ($_POST['status'] == "Inactive" ? "Inactive" : "Active"));
WARNING : this 2nd version yields the "Only variables should be passed by reference" strict standards warning. Consider your situation carefully when choosing this approach.
... But note that your expression,
($_POST['status'] == "Inactive" ? "Inactive" : "Active")
will yield Inactive
when $_POST['status']
is already Inactive
, which is the opposite of the desired behavior you described in your question. I believe you want:
($_POST['status'] == "Inactive" ? "Active" : "Inactive")
EDIT 1
Regarding your comment question, "but, not's possible to put something else for example: if ($_POST['status'] == 'Inactive'){ $Status = ($_POST['status'] == "Inactive" ? "Inactive" : "Active"); else ...
", something like that is legal, but doesn't make too much sense. That literally is the same thing as:
if ($_POST['status'] == 'Inactive') {
if ($_POST['status'] == "Inactive") {
$Status = "Inactive";
} else {
$Status = "Active";
} else {
...
}