1
<?php
session_start();
$pdo = new PDO('mysql:host=localhost;dbname=login','root','');
$email = $_POST['email'];
$senha = $_POST['senha'];
$insert = $pdo->prepare('insert into tb_login (email,senha)VALUE (:email,:senha)');
$insert->bindValue(':email',$email);
$insert->bindValue(':senha',$senha);
$insert->execute();
if($insert->rowCount()==0){
$_SESSION['msg']='Já existe uma conta com esse E-mail ';
header('location:cadastro.php');
}
else if($insert->rowCount()>0){
$_SESSION['msg']='Cadastrado com sucesso';
header('location:cadastro.php');
}
Already solved, put an unset and now only appears the message when I click the button.
– Misael Barbosa