Page 1 of 1

name input

Posted: Thu Jul 24, 2008 5:05 pm
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

Posted: Sat Jul 26, 2008 9:41 am
by Klemen
You can use php's ucwords function.

$name = ucwords($name);

Posted: Sat Jul 26, 2008 6:05 pm
by icepack
oh right, thanks
but where would you recommend i place the code?

how about the 2 sections: /* Let's strip those slashes */

Posted: Mon Jul 28, 2008 11:55 am
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?

Posted: Mon Jul 28, 2008 4:12 pm
by icepack
klemen, please advise how and where to implent this to subject titles also
thank you

Posted: Mon Jul 28, 2008 6:05 pm
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!

Posted: Mon Jul 28, 2008 6:41 pm
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!