I am doing a dynamicall table such as:
<form method="POST" action="recieve.php">
<table>
<thead>
<th>Value</th>
<th>Action</th>
</thead>
<tbody>
<tr>
<td><input type="hidden" name="value_original[0]" id="value_original[0]" value="20000">
<input type="text" id="value[0]" name="value[0]"></td>
<td><button type="button" class="btn btn-info add_input_button" title="Add" onclick="addFunction()"></td>
</tr>
</tbody>
</table>
</form>
<button id="send" type="submit" class="btn btn-success" onclick="check()">Aceptar</button>
The add and delete field are working fine giving me extra spaces in case I need them but after I hit the send button I need it to check if the value is ok, otherwise I need it to ask for a special permission to send it.
<script>
var value_original = [];
var value = [];
function check(){
var j=0;
var k=0;
for(j;j<=i;j++){
value_original[j] = document.getElementById('value_original['+j+']').value;
value[j] = document.getElementById('value['+j+']').value;
value_original[j]=Number(value_original[j]);
value[j]=Number(value[j]);
if(value[j]<value_original[j]){
k++;
}
}
if(k>0){
//ask permission
return false;
}
else{
return true;
}
}
</script>
I have the other php with the function add($data,$username,$password), where username and password are defined in the permission pop up using sweetalert2, which is currently working, but I need to send that information to recieve.php.
How can I do that?