Text UPPERCASE

I am using style="text-transform:uppercase" for text box text capitalisation, great it is working . But…When I post the textbox value from page to other page via php , I view Normal text on second page which I entered in first page .

Suppose I enter value on page first :

JOHN CARTOR

I get like this value in other page :

John cartor , john cartor 

Why? even I am using “transform uppercase” . Is it any other way that we can show value of textbox in uppercase from end to end even when we use php "POST & GET " method?

The text-transform is working on your first page because the textarea on that page is what is styled. It is only changing the visual rendering of the text, it does not change the actual text case that was entered.

The actual text case that was entered is what will be posted to your second page.[quote=“shivkumar, post:1, topic:293445”]
Is it any other way that we can show value of textbox in uppercase from end to end even
[/quote]

If you have control of the CSS on the second page then you can set text-transform:uppercase on the element that receives the text.

1 Like

Yes you are right sir, So I think that if I change css then it is possible.?

What about database I want too show the text capital in my database by css change is it possible?

CSS styles HTML elements, if your database content makes its way to an HTML element then yes you can transform it.

What the script

CSS only alters visual appearance. It cannot alter what the content is.
To alter the case for storage in the database you can change it with PHP using the strtoupper (String to Uppercase) function.
http://php.net/manual/en/function.strtoupper.php

3 Likes

MySQL also has a similar function
https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_upper

How we use this when we transfer one form data to other page form?

Pass the variable’s value through the function before you display it?

I am using like this in text box value: value="<?php echo $_POST['name']; ?>" how we add uppercase code php

As I posted, pass the variable to the function as the argument.

The documentation is your friend

string strtoupper ( string $string )
Returns string with all alphabetic characters converted to uppercase.

2 Likes

You are too :joy::grin:
:sob: ButbI can’t understand
Pls give one example related this .

The manual does have examples.
It is a very simple function to use.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.