I have a site in PHP; I want to redirect to external site after running some code; so I want something in the body tag; to redirect it after my code running; something like following example ; what can i do?
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<header>
</header>
<?php
$myffirend=" ";
$allmyffirend=" ";
$user=$_GET['user'];
// this info save in my db
redirect here // after save the information
other code
?>
You can inject javascript script with redirection:
echo "<script>window.location = 'http://www.yourdomain.com'</script>";
If you want redirect after page load
if (window.addEventListener) {
window.addEventListener("load", afterLoadRedirect, false);
} else {
window.attachEvent('onload', afterLoadRedirect);
}
function afterLoadRedirect(){
window.location='your url';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With