Home > General > Affiliate Marketing Forum

Capitalizing Dynamic Keyword Insertion Script? (2)


01-14-2012 02:08 AM #1 vidivo (Member)
Capitalizing Dynamic Keyword Insertion Script?

I have this code below, however I would like it to automatically capitalize the first letter of each word of the keyword that is being inserted automatically if it is not already done so.... Any help? here is the code i have:


<?php
//Add this to your header
$keyword = $_GET['t202kw'];
if ($_GET['OVKEY']) {
$keyword = $_GET['OVKEY'];
}
$keyword = htmlspecialchars($keyword); //Important
if(!$keyword) {
$keyword = 'Default keyword';
}
?>


Insert: <? echo $keyword; ?>


01-14-2012 04:06 AM #2 tical (Member)

Use the ucwords() function to do this. www.php.net/ucwords

example: $keyword = ucwords(htmlspecialchars($keyword));

"hello world!" after ucwords() would be "Hello World!"


Home > General > Affiliate Marketing Forum