$data
is always true
and checkboxes return always "YES"
. How to solve this problem?
function yesNo($data){
if($data){
return "YES";
}else{
return "NO";
}
}
Checkboxes here:
$txt.="Rozpoczynam działalność gospodarczą: ".yesNo($_POST['indywidualne'])."<br>";
if(!isset($_POST['komunikacja'])||!trim($_POST['komunikacja'])){
$result = array( 'type' => 'error', 'code' => "podaj komunikacje");
endSend($result);
}
$txt.="Chce rozliczać się w terminach kwartalnych: ".yesNo($_POST['komunikacja'])."<br>";
if(!isset($_POST['firmowe'])||!trim($_POST['firmowe'])){
$result = array( 'type' => 'error', 'code' => "podaj rodzaj rozliczenia o");
endSend($result);
}
$txt.="Płatnik VAT: ".yesNo($_POST['firmowe'])."<br>";
if(!isset($_POST['ewidencja'])||!trim($_POST['ewidencja'])){
$result = array( 'type' => 'error', 'code' => "podaj email");
endSend($result);
}
Checkbox in html:
<label for="checkbox-vat">
<input type="checkbox" name="" id="checkbox-vat"> Płatnik VAT
</label>
<label for="checkbox-activity">
<input type="checkbox" name="" id="checkbox-activity"> Rozpoczynam działalność gospodarczą
</label>
<label for="checkbox-quarterly">
<input type="checkbox" name="" id="checkbox-quarterly"> Chce rozliczać się w terminach kwartalnych
</label>