PHP foreach loop inside foreach loop
===

I'm trying to do a foreach loop inside a foreach loop.

I have a form where the user type in some text and hit send. On the server site I loop through an array with email addresses and send out the text message. 

Now I also want the user to be able to use variables in the textarea, like $name. 
So my loop should first loop through the emails, and then str_replace the userinput $name variable, with the names in my array. 

The loop works fine with the email part ($tlf), but not the replace $name part.

Could some spot what I am doing wrong? 

    $message = stripslashes(strip_tags($_POST['message2']));
	$tlf=array("name1","name2");
	$test=array("mname1", "mname2");
	$subject = "Hello world";
	$from = "me@gmail.com";
	$headers = "From: $from";

	foreach($tlf as $name){
		$to = $name. "@gmail.com";
		foreach($test as $navn){
			$message = str_replace('$navn', $navn, $message);}
		mail($to,$subject,$message,$headers);
	}

Thanks a lot.