PHP: How to use Javascript inside PHP code
I would like to run one of JS scripts while redirecting to another webpage .. Script to change a variable in Index.php like below code:
if ($flag == 1) { // echo "<h1> Welcome to Website Home Page </h1>"; if(header("Location: ../../index2.php")) { echo "<script type='text/javascript'> document.getElementById(body).style.color = 'red'; </script>"; }; } else { // echo "<h1>Try Again!!!</h1>"; echo "<div class='alert alert-danger' role='alert'> Your are not a Registered User <i class='fas fa-exclamation-triangle'></i> <br> Please Use below registrarion form.</div>"; }
N.B: Still Junior learning PHP.