manalnor Posted April 1, 2010 Share Posted April 1, 2010 Hello friends, if we have php file (lang.php) where lang are stored Point 1 <? $a[1]['en'] = "Good Day"; $a[2]['en'] = "Hello"; ?> then we have file that shows it using the following code Point 2 <form action="processscript.php" method="post"> <textarea rows="5" cols="80" name="content"> <? $fn = "lang.php"; print htmlspecialchars(implode("",file($fn))); ?> </textarea> <input type="submit" value="Save"> </form> Now this should shows the content of lang.php in textarea where you can edit and here is the action file processscript.php Point 3 <? $fn = "lang.php"; $content = stripslashes($_POST['content']); $fp = fopen($fn,"w") or die ("Error opening file in write mode!"); fputs($fp,$content); fclose($fp) or die ("Error closing file!"); echo "Done"; ?> this mean i can change inside the lang.php then save it now the question at Point 2 should show the enter of lang.php is there any chance or way that it shows only the words i mean it will show it in textarea as <? $a[1]['en'] = "Good Day"; $a[2]['en'] = "Hello"; ?> is there any chance i make it show like this Good Day Hello and in same time i can edit it and saved as it should be for example if i did Good Day to Good Night then saved it will be saved as <? $a[1]['en'] = "Good Night"; $a[2]['en'] = "Hello"; ?> hope you got what i meaning. thanks in advance Link to comment https://forums.phpfreaks.com/topic/197298-what-is-the-chance-for-doing-this/ Share on other sites More sharing options...
teamatomic Posted April 2, 2010 Share Posted April 2, 2010 You are treating the file as a flat file so why not just store it as en.txt Good Day Hello That way you can edit it and when needed parse it into an array. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/197298-what-is-the-chance-for-doing-this/#findComment-1035621 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.