jeudi 21 février 2019

Saving values in a session

i need your help.

Through the URL I get Data for the position and that value is getting passed to a python script.

The first time everything is fine , they value 200 comes in and the stepper make 200 stepps and reaches the defined position . The next time, another value is requested like 100 or maybe -100 (just for example) Through the stepps a defined position should be reached.

The Problem is if my stepper is on 200 stepps and should reach position -100 he actually needs -300 stepps but through the button click in the index.php the value -100 is getting passed.

I tried to solve this problem with a session to overwrite the actual position and get the the "real" value via subtractung or adding up both values but it doesnt work out for me ...

Have you got any ideas how can i solve it ?

session_start();

$newvalue = ($_GET["value"]);

$_SESSION['test'] = $oldvalue + $newvalue ;

echo $_SESSION['test'];

//the problem is i dont know how to save the oldvalue when the page getting refreshed and the new value is coming in

Functional schematic

Just the Code to get the "wrong" values




Aucun commentaire:

Enregistrer un commentaire