i have a form where my customers must input some value at inputs.
my form is like this :
<form action="javascript:send();" enctype="multipart/form-data" id="form_main"><input type="number" name="quantidade" id="qt">
and i have a function called "send()" like this.
function send(arg1){
if(typeof(arg1) === "undefined"){
arg1 = 2
}
document.getElementById('qt').setAttribute('value',arg1);
below i have some ajax post and etc...
all my form is send by method post to this page : pacific_cbc_pr.php
where i have a variable like this.
$quantidade = $_POST['quantidade'];
the problem is that when someone for example input 100 or 200 at input quantidade .
the variable $quantidade must be "2" because i'm not passing parameter. but , the $quantidade is set with the value that the customer input.
someone could help me , because the variable $quantidade must be the value from :
document.getelementbyID....
EDIT : function send whole.
function send(arg1){
if(typeof(arg1) === "undefined"){
arg1 = 2
}
document.getElementById('qt').value = arg1;
$("#warning_alerta").hide();
$("#input_vazio").hide();
$("#login_erro").hide();
var formData = new FormData($('#form_principal')[0]);
$("#loading").show();
setTimeout(function() {
$.ajax({
url: "/xxxx/xxxx/xxxx/pacific_cbc_pr.php",
type: "post",
data: formData,
cache: false,
async:true,
contentType: false,
processData: false,
success: function(result){
if(result == 1)//logado
{
//$("#hide").show();
$('#text_modal').html('que');
$('#modal-container-188641').modal('show');
}
else if (result == 200)
{
$("#login_erro").show();
}
else if (result == 300)
{
$("#login_sucesso").show();
setTimeout(function(){
window.location = "index.php";},3000);
}
$("#loading").hide();
}
})
},300);
};
Thanks.