Jump to content

PHP Header problem using XAMPP


jason1987

What is going on with my header here??  

  1. 1. What is going on with my header here??

    • add in the folder name to php code (dont work though - tried)
      0
    • I dont know
      0


Recommended Posts

I am absoutly baffled and confused by this one. I have a website which is all running as it should using xampp except on pages where they have a header line to goto another page

e.g.

 

header("Location: /jobview?jobid=$jobid");

 

this should then go to that page from the same folder that this page (the one with that code on) is in.

 

But for some reason it jumps up a folder

http://xx.xx.xx.x/jobview?

 

and if i put the folder in the header

header("Location: foldername/jobview?jobid=$jobid");

 

it then displays the folder twice in the address bar!!

 

http://xx.xx.xx.x/foldername/foldername/jobview?

 

what on earth is going on???

 

 

Link to comment
https://forums.phpfreaks.com/topic/102529-php-header-problem-using-xampp/
Share on other sites

I'm not sure why you posted this in the web server section or why you bothered putting a poll, the problem has nothing to do with web servers or what a poll is for.

 

The leading slash / in a relative URL refers to the domain root. So, /jobview means yourdomain/jobview.

 

Adding the a folder to a relative URL means use that folder relative to the current folder, so you get the current folder plus what you listed.

 

Just use - header("Location: jobview?jobid=$jobid");

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.