2
I created a form where I want to enter data in the database, but I don’t want the user to enter the data, so I put display:block
in the form. However when I click the button nothing happens.
The code of form
is as follows:
<form role="form" action="inserir_pedido.php" method="post">
<input type="text" name="id_servico" id="id_servico" style="display:none;">
<input type="text" name="nome_servico" id="nome_servico" style="display:none;">
<input type="text" name="horas" id="horas" style="display:none;">
<input type="text" name="id_profissional" id="id_profissional" style="display:none;" value="<?php echo $_GET['id'] ?>">
<input type="text" name="id_utilizador" id="id_utilizador" style="display:none;">
<button type="button" class="btn btn-info">Enviar email</button>
</form>
Change the button:
type="submit"
. Another tip, fields you want to assign data but do not want them to be visible or editable, it is interesting you use them ashidden
, as in the case of this id_professional name input. If you don’t want it to be visible, but want to be able to capture its value, you don’t need css, just changetype="hidden"
– user28595