Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda