I have php code, but insude that code I should call js alert() function. Is it possible? if yes, how can I do it?
if($findUserRow['active'] == 0){
$message = "You should activate your account!";
alert($message); //here should be pop up window
}
if($findUserRow['active'] == 0)
{
?>
<script>
var message = "You should activate your account!";
alert(message); //here should be pop up window
</script>
<?php
}
You can echo Javsacript to page like as below.
if($findUserRow['active'] == 0){
$message = "You should activate your account!";
echo "<script> alert(".$message.");</script>";
}
You should always separate the backend logic from the frontend logic.
send variables from the back to the front, then process on the front. Ideally you want to use templates in php. Things can get messy.
<script>
var active = <?php echo $findUserRow['active']; ?>;
var message = "You should activate your account!";
if(active == false){
alert(message);
}
</script>
Please focus on isolating the 2. It will give you more controlling generally.