Problems using printf() with mail

I am new to PHP and have wrote a little scripts that my customers can use to get a ballpark quote for painting there house that works. To extend it, I want to have the PHP mail() function send the quote information to myself and a copy to the customer. It works for just general POST variables, however, I cannot seem to understand how to send the calculated data that totals the pricing. I am using printf() to print the final amount which displays correctly in a browser after the user hits submit. I am however lost with the format or code for mail(). I have just included the code for one item (walls):



// Takes the posted form data and comes up with the 
//calculation for wall quote

if ($mheight == 1){ $heightprice = ".80"; $myheight = 8;
			}elseif ($mheight == 2){ $heightprice = ".90"; $myheight = 9;
			}elseif ($mheight == 3){ $heightprice = "1.00"; $myheight = 10;
			}elseif ($mheight == 4){ $heightprice = "1.10"; $myheight = 12;
		    }else{ $heightprice = ".80"; $myheight = 8;
			}
			
		if ($mcolours == 1){ $colourprice = 0;
		    }else{ $colourprice = ($mcolours * 25.00);
			}
			
		$calculate1 = ($heightprice * $mcoats);
		$calculate2 = ($calculate1 * $mfootage);
		
		$calculatewalls =  ($calculate2 + $colourprice);

$calwalls = ($calculatewalls + $calstairwells);

//Displays the amount for the customer
 
Walls:  $<? printf ("%05.2f", $calwalls); ?> <BR />

//I want to send the walls calculation in an email using 
//PHP's mail function. 

//Neither of these work...

$mywalls = printf ("%05.2f", $calwalls);
$message .= "Walls: $". $mywalls ."\
";

$message .= "Walls: $". printf ("%05.2f", $calwalls); ."\
";



Thanks for any help :slight_smile:

printf will output a formatted string, not return it.
To return it, use [fphp]sprintf[/fphp] :slight_smile:

That fixed it. Now to read up on sprintf