convert form data into all CAPS

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
donny
Forum Contributor
Posts: 179
Joined: Mon Aug 11, 2014 11:18 am

convert form data into all CAPS

Post by donny »

hello,

i have a form with name and address and i want to change all their inputed data to capitals. i see how to do this for 1 variable on the php site but is there a way to make 1 function change multiple variables while keeping the variables the same name?

thank you

$name = john doe
$address = 123 sesame street


turn into

$name = JOHN DOE
$address = 123 SESAME STREET

thank you
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: convert form data into all CAPS

Post by requinix »

Yes, but they're basically all the same as just calling strtoupper() on each one individually.

So just do it normally, such as

Code: Select all

$name = strtoupper($_POST["name"]);
$address = strtoupper($_POST["address"]);
donny
Forum Contributor
Posts: 179
Joined: Mon Aug 11, 2014 11:18 am

Re: convert form data into all CAPS

Post by donny »

thank you very much
Post Reply