PHP inside HTML with an error

I have tested PHP and inserted PHP. What is an error inside PHP validation?



 <input type="email" class="form-control <?= $invalid_class_name ?? "" ?>" id="email" name="email" placeholder="john@desiree.com" tabindex="2" required>




I… don’t understand what you’re asking.

The line you have shown is a simple echo statement inside an HTML line.

1 Like

I have checked again. Only <?php or <?= are allowed for PHP tags. It is an issue it is IF sentence not only echo. Can you post the line without an error and echo as it is IF $invalid_class_name TRUE SHOW CLASS ELSE DO NOT NOTHING.
Need help as all classes will be in the same manner.

It’s already a compacted if.

echo $invalid_class_name ?? "" (the <?= becomes an implicit “echo”)

?? is the Null Coalescing Operator. It means if $invalid_class_name is not null, it will echo the class name, if it’s null, it will echo the empty string.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.