Jump to content

PHP Header help


vidar42

Recommended Posts

I searched for my issue and I'm sure it's been covered but I can't seem to find it.

 

I'm doing a login form and want to redirect the page to the username after it is validated.  

 

Here is the code : 

 

 

 

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

 

 

it's not working and it's appending this to the URL : 

 

 

 

profile.php/?id=testuser
 

 

 

I tried escaping the ? and it did the same thing...

 

 

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

 

Help please?

Link to comment
https://forums.phpfreaks.com/topic/276645-php-header-help/
Share on other sites


$aid = $_POST['artcid'];
$uid = $_POST['userid'];

header('location:../artikeldetail.php?msg=86&articleid='.$aid'&userid='.$uid);

 

it returns Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

 

the correct way to do this?

 

 

header('location:../artikeldetail.php?msg=86&articleid='.$aid

 

returns http://localhost/articles/artikeldetail.php?msg=86&articleid=24

 

i want to show user id too

Link to comment
https://forums.phpfreaks.com/topic/276645-php-header-help/#findComment-1423629
Share on other sites

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.