php - Echo placeholder if field is empty -


I have any input that I will place in placeholder text, but only then The empty string is empty. The value known in the text box resonates with a PHP array, but if this value is empty, the placeholder should be echoed instead. For the time being, I've received this code:

 & amp; Lt? Php echo sponsor data ('address0') == ''? 'Address Line 1': 'Other'; ? & Gt;  

Sponsor Data () gets stuff from just one array; This is the only logic key here is the key bit that returns the temporary.

This code gives strange behavior; I get stuff like Hello World Attender Line 1 where Hello World user typed text and address line 1 obviously placeholder oddly From, the placeholder is stored in the array when presented.

My question is: Can someone offer the improvement of my Ternary operator or if he does not work, then I would like to write an inline if statement. Say

Thank you

You are running issues in operator preferences: / P>

  & lt ;? Php echo (sponsor data ('address 0') == ''? 'Address line 1': 'other'); ? & Gt;   

(Put brackets around the Tanner operator details).

Comments