how to change all input field values into upper case

前端 未结 3 865
生来不讨喜
生来不讨喜 2021-01-27 05:35

I have set of PHP fields.

Before sending the values into a query, I want to change the letters to upper case.

Is there a way to do something like:



        
相关标签:
3条回答
  • 2021-01-27 06:03

    You want to use strtoupper

    $cust_name = "john";
    echo strtoupper($cust_name); // Outputs JOHN
    
    0 讨论(0)
  • 2021-01-27 06:10
    $_POST = array_map("strtoupper", $_POST);
    

    This will make all values in the POSTed form upper case.

    There is no general method to apply a function to all variables in scope. They need to be in an array first.

    0 讨论(0)
  • 2021-01-27 06:21

    Is this what you are after? http://php.net/strtoupper

    0 讨论(0)
提交回复
热议问题