samedi 4 avril 2015

need PHP function to echo a value when another is empty

I have 2 inputs, one for username, and one for ID.




  • Username value: <?php echo esc_attr( get_option('username') ); ?>




  • ID value: <?php echo esc_attr( get_option('id') ); ?>




and a division:



<div id="info"><?php echo esc_attr( get_option('username') ); ?></div>


I want a PHP function to echo <?php echo esc_attr( get_option('ID') ); ?> in div#info ONLY IF the username field is not filled by the user.


Thank you.


P.S: Apologize if similar topics already exist, but I have looked'em up and couldn't find a straight answer for such a beginner.


Aucun commentaire:

Enregistrer un commentaire