Solved

header + target

Posted on 2002-05-25
5
2,206 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

822 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