N
N
Nikolay2014-05-20 12:07:02
linux
Nikolay, 2014-05-20 12:07:02

How to enter text from PHP into MySQL database in capital letters?

There is a form with a field number , in which text numbers + letters are entered
there is a simple INSERT query

<input name="number" type="text">
$text = strtoupper($_POST['number']);
$text = mb_strtoupper($_POST['number']);
$query='INSERT...'

and still inserts small.
If you write large - inserts large. What am I doing wrong?
debian system, php5, mysql 5.5

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pavel Solovyov, 2014-05-20
@iNickolay

$text = mb_strtoupper($_POST['number'], 'UTF-8');

V
Viktor Vsk, 2014-05-20
@viktorvsk

bit.ly/1p8BurJ

I
Igor Kakupshev, 2014-05-22
@Gumlokt

Feel free to read the PHP documentation:
www.php.net/manual/en/function.mb-strtoupper.php
Here's an example from there:
<?php
$str = "Mary Had a Little Lamb and She LOVED It Very Much";
$str = mb_strtoupper($str);
echo $str; // Output MARY HAD A LITTLE LAMB AND SHE LOVED IT SO MUCH
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question