
Need help changing form input to leading caps on certain entries
Hi just learning here and looking for help. (so forgive the terminology)
I have a script that takes entries from a form and inserts it into a page
template, to write, and display a new html page.
While it works I would like it to change some entries to leading uppercase
for the first letter of each, if entered in all lower case
eg: " Name" rather than "name"
While I can do this for all the entries, some I would like to leave as they
are typed
names, address', forced to leading caps, - additional comments taken
through a text area left as is
----------------------------------------------------------------------------
------------------------
#!/usr/bin/perl
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/(\w+)/\u\L$1/g;
$fields{$key}=$content;
}
print "Content-type: text/html\n\n";
print "<html><
----------------------------------------------------------------------------
--------------------------
this changes all entries to first letter upper case on each word
----------------------------------------------------------------------------
--------------------------
#!/usr/bin/perl
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/%(..)/pack("c",hex($1))/ge;
$fields{$key}=$content;
}
print "Content-type: text/html\n\n";
print "<html><
----------------------------------------------------------------------------
---------------------------
this leaves all entries as is.
how can I specify to have some entries one way and some the other ?
a quick fix would be great, but I would also like to find a source on the
web where I can learn more about this.
Thanks
Gypsy