Welcome Guest, Not a member yet? Register   Sign In
How to Force Redirect After ECHO?
#1

[eluser]Gewa[/eluser]
Hi. I made code on one server and there the redirect function of URL Helper works after

Code:
print_f($some_array);

On NEw one the redirect is not working. Is there any way to force script redirect anyway?
#2

[eluser]JanDoToDo[/eluser]
Showing the code would be good!

in codeigniter ->

Code:
redirect('page_to_go_to');
#3

[eluser]Gewa[/eluser]
lets say its like this the code ... ( the real code is sooooooooooooooo BIG)


Code:
$my_array=array('foo','boo','goo');

redirect('/myaccount/show/1','refresh');
#4

[eluser]Gewa[/eluser]
Output is like this

Code:
NADO OBNOVIT - 40429 <br/>Change_typeNadbavka Produkta!Array
(
    [pkid] => 21
    [kid] => 2
    [price_old] => 0
    [price_new] => 266.46
    [sklad] => 5
    [proizvodit] => Codegen
)
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  Cannot modify header information - headers already sent by (output started at /home/septima/data/gevork/system/application/controllers/show.php:128)</p>
<p>Filename: helpers/url_helper.php</p>
<p>Line Number: 485</p>

</div>

[code]

on the line 128 there is
[code]
print_f($my_data);
#5

[eluser]JHackamack[/eluser]
The problem is the header() information that is sent can't be modified as soon as PHP sends text. You can't force a redirect after outputting content. You can however, put in a meta tag to refresh to the new URL.
#6

[eluser]Gewa[/eluser]
Then Why in One hosting it's working and in another NO?
#7

[eluser]JHackamack[/eluser]
Are you sure the company you are hosting with is actually echoing out the array?
#8

[eluser]Gewa[/eluser]
Yes. Its making print_f() I see the result and in one second it's reloading next page
#9

[eluser]alboyd[/eluser]
This isn't going to be helpful.. And I will be muted most likely.. But might I be so bold as to proffer:

WTF?
#10

[eluser]danmontgomery[/eluser]
Possible that one installation has output_buffering enabled (which allows for modifying headers after they're sent), and the other has it disabled.

As others have stated it's best to force the redirect through html meta tags or javascript location() call.




Theme © iAndrew 2016 - Forum software by © MyBB