4
Good morning,
I have a database, where users insert various news.
I’ve talked to all of them, not to put capital letters in the inclusion, because it makes the project aesthetically ugly.
Is there a way to issue an alert when registering? For example: "Your title is in capital letters, please correct".
How could generate this alert using the code below?
<?php
require 'conexao1.php';
header ("Content-type: text/html; charset=utf-8");
$titulo = addslashes ($_POST['titulo']);
$sql = "INSERT INTO noticias (titulo) VALUES ('$titulo')";
mysql_query($sql) or die (mysql_error());
if ($sql) {
echo "<script> alert('Título inserido com sucesso!');
}
?>
I’ve been looking for some information, but I confess I haven’t done anything like this yet.
Thanks in advance for the help!
If you are going to display a Javascript warning, if you are going to save the submitted title in uppercase, convert it into minusculas in php and save without warning the user
– rray
I prefer the warning, because if the user puts a proper name for example, it will be all lowercase, and incorrect in the view. " paulo" instead of "Paulo" or "brasil" instead of "Brasil".
– Hebert Richard
It really makes sense, in this case.
– rray