After discovering why my site doesn't redirect by header command, I found another problem. The problem is that I want put some variables into url redirecting, that is in javascript. That's part of my code:
<?php
$cost = 200
$name = 'Bill'
$url_endpoint = 'https://example.com/item1='.$cost.'&n='.$name.'.html';
if( !headers_sent() ) {
header("Location: $url_endpoint");
}
else {
?>
<script type="text/javascript">
document.location.href="$url_endpoint"; //That's just example what I want
</script>
Redirecting to <a href="$url_endpoint">site.</a> //Same here
<?php
}
die();
exit;
} // ?
?>
Any ideas/tips for beginner?
document.location.href='<?php echo $url_endpoint;?>';