I want to run the javascript code inbetween the PHP ,where there is IF else condition. but the Javascript code is working independent from the IF ELSE condition. before i have filled the Registeration form and submitted it.
i have also taken help from ChatGPT but it is not working.
if (mysqli_stmt_execute($stmt)) {
?>
<script src="Js/success-registered.js"></script>
<?php
header("location: login.php");
exit;
} else {
echo "Something went wrong...cannot redirect!";
}
}