hey , I need a function which can take values from text boxes and save every value to the text file in certain place .
I did this but I used an external text file , I took what I need from the original file then put the new values nect to them in the helping file and then I copied it content to my original file .
my file :
I want it to be like this :Code:Sally = 10 Sami = 50
here's my old code :Code:Sally = 1230 Sami = 23450
so I'm writing to "output.txt" and then coping it back to my file , How can I do that ?Code:if(file_exists($trID_Log_File) && filesize($trID_Log_File) > 0) { $h = fopen($trID_Log_File, "r"); $contents = fread($h, filesize($trID_Log_File)); fclose($h); $out_h = fopen("output filename", "w"); if(!stristr($contents, "TrID is best suited to analyze binary files!")) { $lines = explode("\n", $contents); foreach($lines as $line) { if(strlen($line) > 5) { $line_arr=explode("=",$line); if ($line_arr[0]=='Sally') { $line_arr[1]="10"; // The New Value } fwrite($out_h, implode("=", $line_arr)."\n"); } } } }



Reply With Quote

Bookmarks