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

99
Views
Javascript dynamic name to php

i've been doing a seat picker system in which you can click the chair you want and it will take that chair id and insert it into the data base, i have this code

<form method="POST" id="form">
    <input type="button" value="Go to payment." name="" id="so">
<script>

  async function getChairs(){
        let url = "code/chairs.php";
        await fetch(url)
        .then(response=>response.json())
        .then(data=>{ 
            console.log();

            data.forEach(chair=>{
                var $refChair=$(".pos" + "" + chair.id);
                $refChair.attr("src","img/chair-occupied.png");
                $refChair.attr("data-bs-toggle",".popover");
                $refChair.attr("title","This chair is occupied by: ");
                $refChair.attr("data-bs-content", chair.name);
                $refChair.attr('id','2');

                new bootstrap.Popover($refChair);
                
            });
        })

    }
    getChairs()
</script>
        
<script>
cho = [];
id1 = {};


        $(".chair").on("click",function (){
            var chimba = $(this).attr("class");
            let letter1= chimba.charAt(9); 
            let letter2 = chimba.charAt(10); 
            var amazing = letter1+letter2;
            var plis = document.getElementById("so");
            plis.setAttribute("name", amazing);
            var some = plis.getAttribute("name");
            cho.push(some);
            console.log(cho);
            cho.shift(some);
            id1.id = amazing;
            cho.push(id1);
            console.log(id1);
            cho.shift(id1);
            //window.location.href="paymethod.php";
            })
</script>

I save the id from the second script in the top div, but i don't know how to take that information to php, is there a way to take those numbers to php? keep in mind that all of this is in a .php file

I tried to use event listeners, a button to send the info to the same file, i tried to insert it into an external array,

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!