html - I want to write to a certain line on a txt using php -
what want:
file.txt: name: sam email: email@email.com
so have
<?php $myfile = "file.txt"; $txt = 'thetxt'; $file = file($myfile); foreach ($file $row_num => $row) { //idk should here } $file_o = fopen($myfile, "w"); fwrite($file_o, $txt); fclose($file_o); ?>
basically want have 2 , submit button setting text $string , go appropriate line on txt file.
//your file name extension $filename = "file.txt"; //text want add in file $txt = "name: sam" . php_eol . "email: email@email.com" . php_eol ; //save file $myfile = file_put_contents($filename , $txt.php_eol , file_append | lock_ex);
Comments
Post a Comment