Page 1 of 1

Removing underscore

Posted: Fri Nov 07, 2008 9:46 am
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?

Re: Removing underscore

Posted: Fri Nov 07, 2008 10:25 am
by Hannes2k
Hi,
you can use str_replace for replacing the underscores (and replace it with " ").

Re: Removing underscore

Posted: Fri Nov 07, 2008 10:31 am
by pickle
run it through ucwords() first.

Change your string to have a : rather than a = .