How can I make this redirect work?

This is probably so simple I am over thinking it. I followed the tutorial at
http://www.sunnytuts.com/article/login-and-registration-with-object-oriented-php-and-pdo-part-2 got it all working. YAY
at the top of the page I have


 $article_id=$_GET['article_id']; // Collecting data from query string
 if(!is_numeric($article_id)){ // Checking data it is a number or not
 echo "Data Error";
 exit;
 }


But I need to figure out how to make this part

header('Location: home.php?article_id=$article_id');

of the below function work.


public function logged_in_protect() {
		if ($this->logged_in() === true) {
			header('Location: home.php?article_id=$article_id');
			exit();		
		}
	}

no matter how I’ve tried so far what I get in the URL http://www.xxxxxxxx/family/myblog/admin/lar2_1/members.php?article_id=$article_id

Use full quotes.

header("Location: home.php?article_id=$article_id");

Since you are including a variable within the string you will need to either use double quotes, or break out of the single quotes otherwise the variable will just be treated as a string.

header("Location: home.php?article_id=$article_id");
header('Location: home.php?article_id=' . $article_id);

I went DUH for a minute. It was in a function so I had to do this


public function logged_in_protect() {
		if ($this->logged_in() === true) {
$article_id=$_GET['article_id']; // Collecting data from query string
 if(!is_numeric($article_id)){ // Checking data it is a number or not
 echo "Data Error"; 
 exit;
 }
			header("Location: home.php?article_id=$article_id");
			exit();		
		}
	}