Correct Syntax.

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
tate
Forum Newbie
Posts: 5
Joined: Thu Nov 27, 2008 10:09 am

Correct Syntax.

Post 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
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: Correct Syntax.

Post 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"); ?>
tate
Forum Newbie
Posts: 5
Joined: Thu Nov 27, 2008 10:09 am

Re: Correct Syntax.

Post by tate »

thanks, let me try that!
tate
Forum Newbie
Posts: 5
Joined: Thu Nov 27, 2008 10:09 am

Re: Correct Syntax.

Post by tate »

Thanks Syntac!!!!!!!

That works!!.
Post Reply