Hello. I am having this little problem , here is my code; <?php header("Location: msgchanger3.html"); $ourFileName = "test.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); $handle = fopen( "test.txt", "a"); $value = $_POST['111']; $y = '1500'; $x = $value - $y; fwrite($handle, $x); fclose($handle); exit; ?> PHP: I need it to subtract from the "$y" and save the subtracted value so next time you subtract an input it subtracts from the last calculation. I don't know it that makes sense but if you understands please tell me how to , or an approach I should think about on how to do this. Thanks! By The way. I have only been coding PHP for a week or so , so I understand the basics and I am just starting to get more complicated , so if you could keep it as noob friendly as possible , thank you
<?php // Get the value submitted via form $value = $_POST['111']; // Load file content of text.txt value $con = file_get_contents('test.txt'); // Subtract posted value from saved value $new_value = $con - $value; // Save new value to text.txt file file_put_contents('test.txt', $new_value); // Redirect header('Location: msgchanger3.html'); exit(); PHP: Something like that?