header redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Guy
Forum Commoner
Posts: 53
Joined: Sun Jan 12, 2003 3:34 am

header redirect

Post by Guy »

I'm trying to redirect a page using header()

Code: Select all

<?php
header("Location: ../index.php?msg=User does not exists: $UserName")
?>
but I only get the first part of the returned string
when requeting msg (only User)

how can I get it all?
thanks
Guy
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You can't have spaces in the text like that unless they are urlencoded, try something like:

Code: Select all

$msg = urlencode('User does not exists: '.$UserName);
header('Location: ../index.php?msg='.$msg);
Mac
Post Reply