vidar42 Posted April 7, 2013 Share Posted April 7, 2013 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 More sharing options...
requinix Posted April 8, 2013 Share Posted April 8, 2013 Assuming you exit; or die; immediately after the header(), you're redirecting to one version but arriving at another. There must be another redirection somewhere. Link to comment https://forums.phpfreaks.com/topic/276645-php-header-help/#findComment-1423545 Share on other sites More sharing options...
ardhix Posted April 9, 2013 Share Posted April 9, 2013 $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 More sharing options...
requinix Posted April 9, 2013 Share Posted April 9, 2013 Okay... header('location:../artikeldetail.php?msg=86&articleid='.$aid'&userid='.$uid);Look at that. You're missing a bit of punctuation. Link to comment https://forums.phpfreaks.com/topic/276645-php-header-help/#findComment-1423632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.