Problem with validation

0

I have this input in php :

<input id="complement" class='input-without-icon' type="text" placeholder="Complemento/Referência" value='<?php echo $Menu->getAddressComplement() ?>' />

I set the id of it to javascript and via ajax send to another file php ,

if ($street === $streetOriginal && $town === $townOriginal && $complement === $complementOriginal) {
    $stmtSaveAddress = $conn->prepare("UPDATE address SET street = :street, number = :number, town = :town, complement =                                       :complement, city_id = (select city.city_id from city where city.link = :cityLink) WHERE address_id = :address");
    $stmtSaveAddress->bindValue(':street', $street);
    $stmtSaveAddress->bindValue(':number', ($number <= 0 ? NULL : $number));
    $stmtSaveAddress->bindValue(':town', $town);
    $stmtSaveAddress->bindValue(':complement', $complement);
    $stmtSaveAddress->bindValue(':cityLink', $city);
    $stmtSaveAddress->bindValue(':address', $addressId);

    echo'rua: '.$street;
    echo'number: '.$number;
    echo'bairro: '.$town;
    echo'complement: '.$complement;
    echo'cityLink: '.$city;
    echo'complemento original: '.$complementOriginal;
    echo'complemento: '.$complement;
        if ($stmtSaveAddress->execute()) {
            echo 'trueaddress';
        } else {
            if ($townOriginal != $town) {
                echo 'town';
            }
            if ($streetOriginal != $street) {
                echo 'street';
            }
            if ($complementOriginal != $complement) {
                echo 'complement';
            }
        }
}

I do exactly the same thing for street , town and complement , but I'm having problem only with complement . I check if there is a curse if it has it falls in else , otherwise it executes. What can it be? I have echo in the variables and they are all as they should be.

Here I correct the profanity:

$obs = correctBadWords($obsOriginal); $history = correctBadWords($historyOriginal); $town = correctBadWords($townOriginal); $complement = correctBadWords($complementOriginal); $street = correctBadWords($streetOriginal); $name = correctBadWords($nameOriginal);

    
asked by anonymous 11.10.2016 / 13:49

0 answers