add two variables to php header location

DomboCom

New member
Jun 4, 2009
381
8
0
I have a script that is redirecting based off of the $url variable. This works...
PHP:
header("location:".$url);
But I need to add my T202 keyword as well, so I added
PHP:
$t202kw = $_GET['t202kw'];
and trying to do something like like...
PHP:
header("location:".$url . $t202kw);
How can I add that T202kw variable to the end of the URL? I keep getting"
"Warning: Header may not contain more than a single header, new line detected. in... on line 20"

Thanks!
 


makes more sense to do something like
Code:
<?php
$url = "http://www.somethinghere.com";
$t202kw = isset($_GET['t202kw'])?$_GET['t202kw']:'';
$newurl = $url."?variable=".$t202kw;
header("location:".$newurl);
?>

Now the header already sent, or new lines you need to make sure your variables, and such do not have line breaks in them, and you also need to make sure no characters such as whitespaces are sent to the browser prior to the header function.

PS: What's on line 20?
 
makes more sense to do something like
Code:
<?php
$url = "http://www.somethinghere.com";
$t202kw = isset($_GET['t202kw'])?$_GET['t202kw']:'';
$newurl = $url."?variable=".$t202kw;
header("location:".$newurl);
?>
Now the header already sent, or new lines you need to make sure your variables, and such do not have line breaks in them, and you also need to make sure no characters such as whitespaces are sent to the browser prior to the header function.

PS: What's on line 20?

Cool, thanks for that! Line 20 is the header location line.