Answer the question
In order to leave comments, you need to log in
How to output DIV via ECHO?
You need to check for the presence of a variable and, if so, display a block with buttons. I do it like this:
<?php if(isset($row)) { //проверяем наличие
echo
'<div class="uk-button-group">
<a class="uk-button uk-button-link uk-button-large" href="../auth/signup.php">Регистрация</a>
<a class="uk-button uk-button-success uk-button-large uk-margin-left" href="../auth/login.php" style="background-color: #ffb433;"onmouseover="this.style.backgroundColor='#eb8d00';" onmouseout="this.style.backgroundColor='#ffb433';"><i class="uk-icon-lock uk-margin-small-right"></i> Войти</a>'
</div>'
}
?>
Answer the question
In order to leave comments, you need to log in
<?php if(isset($row)) : ?>
<div class="uk-button-group">
<a class="uk-button uk-button-link uk-button-large" href="../auth/signup.php">Регистрация</a>
<a class="uk-button uk-button-success uk-button-large uk-margin-left" href="../auth/login.php" style="background-color: #ffb433;"onmouseover="this.style.backgroundColor='#eb8d00';" onmouseout="this.style.backgroundColor='#ffb433';"><i class="uk-icon-lock uk-margin-small-right"></i> Войти</a>'
</div>
<?php endif; ?>
onmouseover="this.style.backgroundColor='#eb8d00';"
First, according to the standards, single quotes do not need to be put here at all.
Secondly, if you need single ones inside 'string', you should escape them:
echo 'String with \'in quotes\' inside';
Thirdly, you can (for me, it's much better) write like this:
<?php if(isset($row)) { //проверяем наличие ?>
<div class="uk-button-group">
<a class="uk-button uk-button-link uk-button-large" href="../auth/signup.php">Регистрация</a>
<a class="uk-button uk-button-success uk-button-large uk-margin-left" href="../auth/login.php" style="background-color: #ffb433;"onmouseover="this.style.backgroundColor='#eb8d00';" onmouseout="this.style.backgroundColor='#ffb433';"><i class="uk-icon-lock uk-margin-small-right"></i> Войти</a>'
</div>
<?php } ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question