Removing underscore

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
javiqq
Forum Newbie
Posts: 17
Joined: Wed Oct 29, 2008 9:15 am

Removing underscore

Post by javiqq »

I'm using the following script to pick up values from fields in a submitted form:

foreach($_POST as $field => $value)
{
echo "$field = $value<br>";
}

and it generates the following:
first_name = javiqq
last_name = Javiqq

So it's working, but how do I remove those underscores from "first_name" to have it say "First name" in a nicer font. Also how do I replace the assignment operator and use a colon?
Hannes2k
Forum Contributor
Posts: 102
Joined: Fri Oct 24, 2008 12:22 pm

Re: Removing underscore

Post by Hannes2k »

Hi,
you can use str_replace for replacing the underscores (and replace it with " ").
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Removing underscore

Post by pickle »

run it through ucwords() first.

Change your string to have a : rather than a = .
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply