Page 1 of 1

Correct Syntax.

Posted: Thu Nov 27, 2008 10:13 am
by tate
Hi all

Do you know the correct syntax for this: <?php header("Location: http://www.testsite.co.uk/index.php?sid=".$var); ?>

basically this is correct: <?php header("Location: http://www.testsite.co.uk/index.php?sid="); ?>

but what is the correct syntax for adding the $var to the end??

Thank you.

Tate

Re: Correct Syntax.

Posted: Thu Nov 27, 2008 10:17 am
by Syntac
If $_GET["sid"] is supposed to be set to $var, do this:

Code: Select all

<?php header("Location: http://www.testsite.co.uk/index.php?sid=".$var); ?>
...or, because you're using double quotes, you can just stick the variable in the string, like so:

Code: Select all

<?php header("Location: http://www.testsite.co.uk/index.php?sid=$var"); ?>

Re: Correct Syntax.

Posted: Thu Nov 27, 2008 10:24 am
by tate
thanks, let me try that!

Re: Correct Syntax.

Posted: Thu Nov 27, 2008 10:40 am
by tate
Thanks Syntac!!!!!!!

That works!!.