transfer variable-content from script to php.

Discussion in 'JavaScript' started by Horosol, Mar 25, 2021.

  1. #1
    I created a html for local use and want to sent data to a local ini.txt file, from which the html then can later retrieve it.
    I did try cookies, but the result was sad.

    So now I aim for php. Desktop - local php.
    The retrieving works fine. But the sending to my ini file, does not work for me.

    There is <script> where I make the data to be send
    and there is <?php that does the sending.
    I can not transfer variable-content from script to php.

    For the retrieving I use:
    <?php
    $myfile = fopen("ini.txt","r");
    $begin = fread($myfile,40);
    fclose($myfile);
    ?>

    <script>
    begin = <?php echo $begin ?>;
    var beginarray = begin.split(';');

    This works fine, but
    So far I am not able to find anything comparable for the sending.

    If I use
    <body>
    <script>
    var NB;
    var EL;
    //NB and EL will be filled in the program;
    var tekst = "NB="+NB + ";EL=" +EL ;
    </script>

    tekst <action="destination.php"> ;

    <?php
    $result = $_GET;
    echo $result;
    ?>

    </body>

    Then the $result does echo: "tekst" and not the content of the variable.
    I looked for a print command as an counterpart of echo. For PUT and POST.
    I tried to put the <action> inside the <script> or flat in the <body>, or in a seperate <script>.
    Can anybody help me?
     
    Horosol, Mar 25, 2021 IP