Login with PHP using PDO

Asked

Viewed 199 times

1

I already know how to register, but login is a bit complicated for me. I found some materials on the internet and I would like to know what the following line does. I know I’m collecting the form information, wanted to know what you do specifically " ? $_POST['password'] : ''; " that part of the line ahead.

// resgata variáveis do formulário
$email = isset($_POST['email']) ? $_POST['email'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';

1 answer

2


That’s what we call a if ternary. What comes after the assignment (=) and before the ? is a condition for attributing what comes before or after :.

? == if
: == else

In a practical example you can have:

$minha_variavel = $se_aqui_for_verdadeiro ? $isso : $se_nao_isso;
  • Thank you very much Kenny Rafael

  • No @Srweb, consider marking the answer as correct if it has helped! =)

  • It is marked my friend, sorry for the delay, incredible as it seems I stayed almost 1 month without having to come to the forum, that is good not? KKKK Signal that things were going well, thanks

  • hahahha that there, needing!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.