Patrick3002 Posted October 13, 2006 Share Posted October 13, 2006 Hi, im editing a file which would take forever to edit with out a program. I have created one for different stuff but im stuck on this....I need to be able to insert numerous lines like:DEL "c:\windows\servicepackfiles\i386\adv11nt5.dll"DEL "c:\windows\servicepackfiles\i386\advapi32.dll"DEL "c:\windows\servicepackfiles\i386\advpack.dll"DEL "c:\windows\servicepackfiles\i386\aec.sys"DEL "c:\windows\servicepackfiles\i386\afd.sys"DEL "c:\windows\servicepackfiles\i386\agentanm.dll"DEL "c:\windows\servicepackfiles\i386\agentctl.dll"into a textarea and then hit a submit button and have them come out like:DEL "f:\windows\servicepackfiles\i386\adv11nt5.dll"DEL "f:\windows\servicepackfiles\i386\advapi32.dll"DEL "f:\windows\servicepackfiles\i386\advpack.dll"DEL "f:\windows\servicepackfiles\i386\aec.sys"DEL "f:\windows\servicepackfiles\i386\afd.sys"DEL "f:\windows\servicepackfiles\i386\agentanm.dll"DEL "f:\windows\servicepackfiles\i386\agentctl.dll"notice the c: changes to f:I need it to display just like that too, each one on a different line.Here is my current program i am not sure how to edit this to work with those " etc.[code]<form name="strreplace" action="strreplace.php" method="post"><textarea name="main" cols="50" rows="40" wrap="VIRTUAL" id="main"></textarea><input type="submit" value="Submit"></form><?$main=$_POST['main'];$main = str_replace("c:","<br>f:","$main");echo stripslashes($main);?>[/code]You can view it live here: [url=http://lyricsdbonline.com/strreplace.php]http://lyricsdbonline.com/strreplace.php[/url] Link to comment https://forums.phpfreaks.com/topic/23842-string-replace-func/ Share on other sites More sharing options...
mjlogan Posted October 13, 2006 Share Posted October 13, 2006 You were close[code=php:0]<form name="strreplace" action="strreplace.php" method="post"><textarea name="main" cols="50" rows="40" wrap="VIRTUAL" id="main"></textarea><input type="submit" value="Submit"></form><?$main=$_POST['main'];$main = str_replace("c:","f:","$main");echo nl2br(stripslashes($main));?>[/code] Link to comment https://forums.phpfreaks.com/topic/23842-string-replace-func/#findComment-108291 Share on other sites More sharing options...
heckenschutze Posted October 13, 2006 Share Posted October 13, 2006 [code]<form name="strreplace" action="strreplace.php" method="post"><textarea name="main" cols="50" rows="40" wrap="VIRTUAL" id="main"></textarea><input type="submit" value="Submit"></form><?$main=$_POST['main'];$main = str_replace("c:","<br>f:","$main");echo "<pre>";echo stripslashes($main);echo "</pre>";?>[/code] Link to comment https://forums.phpfreaks.com/topic/23842-string-replace-func/#findComment-108292 Share on other sites More sharing options...
Patrick3002 Posted October 13, 2006 Author Share Posted October 13, 2006 Ahhhh! Thank you very much! :D Link to comment https://forums.phpfreaks.com/topic/23842-string-replace-func/#findComment-108293 Share on other sites More sharing options...
mjlogan Posted October 13, 2006 Share Posted October 13, 2006 [quote author=heckenschutze link=topic=111385.msg451341#msg451341 date=1160742498][code]<form name="strreplace" action="strreplace.php" method="post"><textarea name="main" cols="50" rows="40" wrap="VIRTUAL" id="main"></textarea><input type="submit" value="Submit"></form><?$main=$_POST['main'];$main = str_replace("c:","<br>f:","$main");echo "<pre>";echo stripslashes($main);echo "</pre>";?>[/code][/quote]you need to remove the [code]<br>[/code] from the str_replace in that one Link to comment https://forums.phpfreaks.com/topic/23842-string-replace-func/#findComment-108294 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.