Friend, a simple solution would be just using Jquery and CSS, I’ll leave an example below for you.
$('#btn-post').click(function(){
if($('#name').val() == "Jorge" && $('#mail').val() == "123"){
$('p').text('Login efetuado,Botão painel visível!')
$('#btn-painel').show();
}
else{
$('#btn-painel').hide();
$('p').text('Login incorreto, botão não disponível!')
}
})
#btn-painel{
display:none;
}
<div>
<label for="name">Nome:</label>
<input type="text" id="name" />
</div>
<div>
<label for="mail">E-mail:</label>
<input type="email" id="mail" />
</div>
<div>
<label for="msg">Mensagem:</label>
<textarea id="msg"></textarea>
</div>
<div class="button">
<button id="btn-post">Clique para testar!</button>
<button id="btn-painel">Painel</button>
<p></p>
</div>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
To test, type in the field name "Jorge" and in E-mail = "123", just to simulate a login, if the data is this, the button will be visible, if it is not, it will be hidden.
You have an extra double quote in your code, here
"echo
. Remove it. You should also escape the quotes inside the string. See here. Otherwise, the logic is the same.– Gabriel Heming