Jump to content

Recommended Posts

hi, just trying to redirect my user when they login to there profile.

 

I'm trying to do this with the follow but it's not owrking anymore.

$profileID = $_SESSION['id'];
header("Location: /profile.php?id=$profileID");

 

it worked the first few times but now its just given up all hope.

 

Help please.

 

Sorry rephrase. The redirection is working but it won't insert the id into the url.

Link to comment
https://forums.phpfreaks.com/topic/112879-redirect-profile-id/
Share on other sites

hi, just trying to redirect my user when they login to there profile.

 

I'm trying to do this with the follow but it's not owrking anymore.

$profileID = $_SESSION['id'];
header("Location: /profile.php?id=$profileID");

 

it worked the first few times but now its just given up all hope.

 

Help please.

 

header("Location: /profile.php?id=$profileID");

 

Does that line of code need to be...

 

header("Location: ../profile.php?id=$profileID");

 

..perhaps? It is hard to tell since I can't see your file directory.

Link to comment
https://forums.phpfreaks.com/topic/112879-redirect-profile-id/#findComment-579787
Share on other sites

header(); functions seem to give alot of grief.. and you always have to put the header function in the head.. and not all the time it is..

 

The header function does not need to be in the head, in fact it can't be called after any output to the browser so placing it within a html <head> will produce an error.

 

You simply need to organise your logic properly so that header() is called prior to any output being sent. Ask yourself this. What is the point of outputting to the browser if all your going to do is redirect to another page?

 

Exactly, there is no point.

Link to comment
https://forums.phpfreaks.com/topic/112879-redirect-profile-id/#findComment-580569
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.