Solved

header + target

Posted on 2002-05-25
5
2,209 Views
Last Modified: 2007-11-27
hi,

another prob here.
can i use target in my url when i use header for redirect?

example:
header("location:start.php");

but, start.php will actually load 2 frames (one top, one down), and i only want either the down-frame to reload, or load start.php in _parent (or _self)

(somehow i assume this will require javascript, hope i'm wrong)

cheers
Ricky
0
Comment
Question by:Paurths
  • 2
  • 2
5 Comments
 
LVL 32

Expert Comment

by:Batalf
ID: 7034790
I think you have to use Javascript for this. To reload one frame with javascript:

in start.php:

<script>
top.frames[1].location.href='newUrl.html?random='+Math.random();
</script>

You could also use location.reload() to reload the frame.

Batalf
0
 
LVL 7

Expert Comment

by:axis_img
ID: 7034798
This sounds like a javascript solution to me as well... I would have to see more of the setup to know for sure though. You can't use target in a php header, unfortunately. The header will simply redirect to the page specified, and only in the frame that contains the header.

There may be another solution though, but please post a little more detail about what you are trying to do.

Thanks
Barry
0
 
LVL 7

Accepted Solution

by:
axis_img earned 100 total points
ID: 7034809
"or load start.php in _parent (or _self)"

Is this always the case? start.php will ALWAYS need to open in the parent, and not be contained within a frame?

If so, then you may be able to simply do the following inside the start.php script:

Add this javascript line into start.php, which will force start.php to reload itself as the parent when it is called.

<script language="javascript">
if(top!=self){top.location=self.location;}
</script>

I am not sure if this is what you are talking about. Let me know.
0
 
LVL 12

Author Comment

by:Paurths
ID: 7034815
thanx barry,

that did it,

i'm sure i can use in a couple of other cases i've run into trouble with this.
i've only been using php for 4 days or so now...
html/asp a little longer (couple of years) but never learned javascript
i guess its time for that.

u guys are great.

cheers
Ricky
0
 
LVL 12

Author Comment

by:Paurths
ID: 7034817
btw, batalf,

your example 'seems' to work (seems logic) but it only refreshed the top-frame (even if i change the 1 to 0, or to the frame-name)

cheers
Ricky
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
php error 27 61
Need guidance for special auto increment values 2 24
Special characters in a TCPDF 4 29
Update Set Column Query Not Working as Expected 6 12
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question