O
O
OwerFan2020-05-25 23:53:29
PHP
OwerFan, 2020-05-25 23:53:29

How to redirect user?

An example is

<?php 
if(){
...
?>
<script>
...
</script>

<?php } ?>
How do I redirect the user to another page after executing this script? And here the redirect will not help. It will give an error
like visited but the script is not executed at the end window.location.href = "http://te/";

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
Oleg, 2020-05-26
@OwerFan

https://github.com/bcit-ci/CodeIgniter/blob/develo...
The engine is old. Therefore, as an example, it is more convenient. See the function body at the link.
You just need to give the right header.
Another way
htmlbook.ru/html/meta/http-equiv

I
iamdivine, 2020-05-25
@iamdivine

header("Location: /script.php");

F
FanatPHP, 2020-05-26
@FanatPHP

You've been asking this question for the third time, you've been suffering for a week , ten people have already told you that it's not about the redirect method, but about the fact that you have hellish code and spaghetti.
But anyway, instead of the question "I need to solve a certain problem, so I made such a horror, how can I do it right?" you keep trying to find some magical way to redirect.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question