I'm trying to adapt an email-based 'recommend this page' script taken from a free scripts site, & am running into trouble with the 'ucwords' routine.
The script returns a list of upto 4 recipients to whom emails have been sent. I'd like each name to appear on a new line, with the first letters of the names capitalised, but I can't get it to work. At the moment, only the first name is capitalised, & I can't get the second name to appear on a new line. The relevent script is below.
Any help appreciated.
...
// cycle through the email addresses and names
$items="5";
$tally="";
for ($numitems=0; $numitems < $items; $numitems++) {
if (($fname[$numitems]!="") && ($femail[$numitems]!="")) {
mail("$femail[$numitems],","$yname went to $sitename and recommended you check it out","Hello $fname[$numitems],\n\n$yname found my website and thought you might find it interesting.\nYou can find it here:\r\n\n$siteaddress \r\n\nAdditional Comments: \n------------------------------------ \n$comments \n------------------------------------\n\nThank you!\n \n$sitename \n$adminaddress \n$siteaddress","FROM:$yemail");
$tally.="$fname[$numitems]";
$tally=ucwords($tally);
}
}
?>
<p>Your recommendation has been sent to:<br/><?php echo "$tally.\n"; ?></p><br/>
<p>Thanks very much!</p>
<p><b><a href="<? echo "$url"; ?>">Back to home page</a></b></p>
...