I have a form which loads multiple text files into each form element as follows;
'selected disabled><?php $atis_info_file_contents = file_get_contents('../data/ATIS_info.txt');echo($atis_info_file_contents); ?> <?php $filename = '../settings/settings_infoletter.txt'; $eachlines = file($filename, FILE_IGNORE_NEW_LINES); foreach($eachlines as $lines){echo "$lines"; } fclose($filename); ?>Then when the form is submitted;
<?php if(isset($_POST['submit'])) { $data_infoletter=$_POST['atis_infoletter']; $fp1 = fopen('../data/ATIS_info.txt', 'w'); fwrite($fp1, $data_infoletter); fclose($fp1); } ?>I have multiple fields and writes as per the above. The however when loading the form doesn’t always load the previous data, and sometimes doesn’t write the new selection.
I read that I may not be able to update multiple text files in one go from the form submit, is that correct, or is there a simple method?