Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

PHP Newb Needs Help w/ String Replace

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

NickRac

Yes.VIP Member
Impact
35
Hey guys,

Here is my line of HTML and PHP:

http://pastebin.com/m22cb4b33

let's say key=Art_History

I want it to display "Art History" in the header.

what code do I need to add to this to accomplish it?

I appreciate and rep+ any help!

Nick
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
$key = str_replace("_", " ", $key);
 
0
Close
do I put that right before the echo?

Also I want it to apply this only to this specific line of code - I use "key" again later in the page and don't want to replace for that one.
 
0
Close
you could use str_replace("_", " ", $key); in the echo itself which would keep $key in tact.

If you use this more than once I would put it in a variable however.
 
0
Close
So essentially you will need to make sure all categories are spaced Like_This and nothing else for the categories otherwise it won't display right with just this code. If you're using it more than once try this:

PHP:
<h2><?php $cat = htmlentities(urldecode(str_replace("_"," ",$_GET['key']))); echo $cat."<br /><br />Some more text blah blah category: ".$cat; ?></h2>

-RageD
 
Last edited:
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Each character of a domain name in its own box, with how to type one of them
Bookmarks: see bookmarks without a label
You can now show only the bookmarks you have not labeled. Open the label filter in the Bookmarks tab of your account menu, or on your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back