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

137
Views
How to set js variable in php and save it into data base

I create new variable and next code is add value to this variable. This code have Load (working) and dont working save i try to fix search google and i dont know

<?php
    session_start();
    ?>

    <script type="text/javascript">

    var drzewo = 0;
    var ustdrzewo = 1;
 
    
    /* L O A D */
    
    function wczytaj() {
    drzewo = <?php echo $_SESSION['drewno']; ?>;
    ustdrzewo = <?php echo $_SESSION['ustdrzewo']; ?>;
    document.getElementById("drzewo").innerHTML = drzewo;
    document.getElementById("ustdrzewo").innerHTML = ustdrzewo;

    }
    /* S A V E */
    function zapisz() {
        <?php
    $_SESSION['drewno'] = "<script type='text/javascript'> document.getElementById('drzewo').innerHTML = drzewo; </script>"
        ?>
        window.location.href = "zapis.php"
    }

function addwood() {
        drzewo +=ustdrzewo
        document.getElementById("drzewo").innerHTML = drzewo;

    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

<script type="text/javascript">
//include jquery
$.post( "other.php", { drewno: drzewo } );
</script>

other.php

<?php 
    $_SESSION['drewno'] = $_POST["drewno"];
?>
about 4 years ago · Juan Pablo Isaza Report
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!