Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!