jeudi 26 avril 2018

Input doesn't send to database

I'm trying to send this string "ACT - Atividade p. condições de trabalho" to the database using an input but when i try to do so, it doesn't add to the database, and no php error is shown neither is when i try to add in a mysql query.

But if for example i try to add this string "AST - Ativiasdde s. condiasdões de trabasho" that is very similar throught the same input it works.

And if i try to add the same string using a textarea instead of an input it works.

I have even tried to change the collation of the database and its tables, but nothing.

Here is code of the used input:

<input id="nome" name="nomeContacto" type="text"
class="form-control" placeholder="Nome" required maxlength="45" 
onkeyup="clean('nome')" onkeydown="clean('nome')" 
onfocus='hidealltooltips()' data-trigger="manual" data- 
toggle="tooltip" data-placement="top" title="Não são Permitidos &ldquo;&rdquo;, &lsquo;&rsquo;, &#38;, &#36;, \ /, (), 
[], {}, # e >< "      oninvalid="this.setCustomValidity('O Nome do Contacto não pode ficar em branco.')" 
oninput="setCustomValidity('')"/>

And here is the php code:

$nome = $_POST['nomeContacto'];
$morada = $_POST['morada'];
$localidade = $_POST['localidade'];
$codPostal = $_POST['codPostal'];
$email = $_POST['email'];
$observacoes = $_POST['observacoes'];
$fax = $_POST['fax'];

$connection->query("INSERT INTO dadoscontactos (nomeContacto, morada, localidade,
codPostal, email, observacoes, fax) VALUES ('$nome','$morada','$localidade',
'$codPostal','$email','$observacoes','$fax')");

Thanks in advance! :D




Aucun commentaire:

Enregistrer un commentaire