Hi, I'm getting a parse error when I try and extend my php code. This is the it i have working ok so far: It inserts a keyword if one is used. Now I needed to remove hyphens so am trying to use this: but I get the parse error. I'm really no expert at this so if anyone could point out any errors I'd be very grateful. I need to insert a keyword when one is used, with a preceding word and remove any hyphens. Thanks
this should work <?php if(isset($_GET['kw'])) { $MainKeyWord=str_replace("-"," ",$_GET['kw']); echo ucwords( "preceding text".$MainKeyWord); } else echo "Alternative text"; ?> PHP:
Bloomin heck! That was fast! kmap, thanks very much, it works a treat now! But I realised just now after inserting it that I also need to strip out apostrophes if they are there. Is there a neat solution for that? If it was just the apostrophes I guess the $MainKeyWord would be along the lines of: but I'm unsure of how to do both the hypen and the apostrophes at the same time, thanks again for the rapid response