name input

Is message board greying out your hair (at least what's left of it)? Let us help you here
Locked
icepack
Posts: 70
Joined: Mon Oct 15, 2007 1:38 pm

name input

Post by icepack »

hello
i noticed that if names, e.g. "joe bloggs" was entered it would appear as "joe bloggs". how can i make it "Joe Bloggs". i.e. automatically 1st letter of each word into capital letters
thanks
[b][color=red][url=http://ilumu.com]UK Website Design Specialists - ILUMU.COM[/url][/color][/b]
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

You can use php's ucwords function.

$name = ucwords($name);
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
icepack
Posts: 70
Joined: Mon Oct 15, 2007 1:38 pm

Post by icepack »

oh right, thanks
but where would you recommend i place the code?

how about the 2 sections: /* Let's strip those slashes */
[b][color=red][url=http://ilumu.com]UK Website Design Specialists - ILUMU.COM[/url][/color][/b]
Weird Dragon
Posts: 4
Joined: Mon Jul 28, 2008 11:47 am

Post by Weird Dragon »

I suggest that you change your mind on that idea. Your own username in this forum icepack starts with a lower case. Other people might like to write a name starting with lower case.

Wouldn't it make more sense to consider making the words in the subject start with capital letters if at all doing it any place?
icepack
Posts: 70
Joined: Mon Oct 15, 2007 1:38 pm

Post by icepack »

klemen, please advise how and where to implent this to subject titles also
thank you
[b][color=red][url=http://ilumu.com]UK Website Design Specialists - ILUMU.COM[/url][/color][/b]
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

You should give Weird Dragons' input some consideration, but if you want to do this anyway add

Code: Select all

$name = ucwords($name);
just below

Code: Select all

$name=pj_input($_POST['name'],'Please enter your name!');
and for subject add

Code: Select all

$subject = ucwords($subject);
just below

Code: Select all

$subject=pj_input($_POST['subject'],'Please write a subject!');
The second code is located TWICE in mboard.php!
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
icepack
Posts: 70
Joined: Mon Oct 15, 2007 1:38 pm

Post by icepack »

hi klemen
thanks for the help
i found most people on my forum type in their real names as opposed to a nickname/username (as the theme is serious) so decided to go for the change to tidy things up.
cheers!
[b][color=red][url=http://ilumu.com]UK Website Design Specialists - ILUMU.COM[/url][/color][/b]
Locked