Data Do Not Pass Before Submitting

0

Good afternoon. I'm new here in the forum and new to programming and I'm stuck in an action.

I'm calling a modal window for the user to enter some information and clicking save information goes to inputs inside the form and the form is submitted.

The problem is that when I debug the code everything happens the moment it should, but when the code runs normal the information does not enter the inputs and the query breaks. As if the submit was first that the update.

I would like to understand what I am doing wrong and why this happens.

Code:

First I create with the page the empty input:

<input type='text' value='' id='vN'>

In the click event of the button in the modal window, Jquery below moves the modal window field information to the input in the form and calls the submit:

$("#vN").val($("#numNegocio").val());
$("#btSalvar").click(); 

3º The value of the input would be used in the save function in PHP, but when it arrives at this moment the information is no longer in the input:

$n01 = isset($_POST['vv'])?$_POST['vN']:"";
    
asked by anonymous 14.12.2018 / 21:25

1 answer

1

As discussed by Andrei Coelho, the problem was in the absence of name in the element. With this, the $_POST['vv'] was not receiving the value of the field. Just add the name:

                                     ↓↓↓
<input type='text' value='' id='vN' name='vN'>
    
15.12.2018 / 03:38