Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
How to INSERT javascript btn-increase value into SQL table using PHP

so the question is: how do I insert my "btn-increase" value from front end to my SQL table. When I try to submit my form it inserts the value as 0 although the value was set to 4 on the form.

Here is the code:

<label class="form-label">$ / per hour</label>
   <div class="d-flex align-items-center">
      <div class="btn btn-items btn-items-decrease">-</div>
         <input class="form-control input-items" name="price" type="text" value="1" disabled>
      <div class="btn btn-items btn-items-increase">+</div>
  </div>


     // ------------------------------------------------------- //
     //   Increase/Decrease product amount
     // ------------------------------------------------------ //
     $(".btn-items-decrease").on("click", function () {
      var input = $(this).siblings(".input-items");
         if (parseInt(input.val(), 10) >= 1) {
         if (input.hasClass("input-items-greaterthan")) {
            input.val(parseInt(input.val(), 10) - 1 + "+");
            } else {
            input.val(parseInt(input.val(), 10) - 1);
            }
          }
        });

        $(".btn-items-increase").on("click", function () {
         var input = $(this).siblings(".input-items");
           if (input.hasClass("input-items-greaterthan")) {
           input.val(parseInt(input.val(), 10) + 1 + "+");
    } else {
           input.val(parseInt(input.val(), 10) + 1);
         }
      });

Then using PHP I'm trying to get the incremented value from the form but it doesn't read the set value. How should I go about inserting the set js value using PHP?

I'm sure this may come off as super easy I'm just really stuck on how to go about this, thanks.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda