alphadeltaviii Posted February 23, 2008 Share Posted February 23, 2008 Ok, i am using FCKeditor to submit values into my DB, but i am writing a script to edit these values. FCKeditor will not work if there are line-breaks in the code, so is there any way to remove them with php? Link to comment https://forums.phpfreaks.com/topic/92549-remove-line-breaks-from-form/ Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 yes use trim() Link to comment https://forums.phpfreaks.com/topic/92549-remove-line-breaks-from-form/#findComment-474236 Share on other sites More sharing options...
alphadeltaviii Posted February 23, 2008 Author Share Posted February 23, 2008 so for example trim($variable) ? Link to comment https://forums.phpfreaks.com/topic/92549-remove-line-breaks-from-form/#findComment-474237 Share on other sites More sharing options...
teng84 Posted February 23, 2008 Share Posted February 23, 2008 try this... echo str_replace("\n","","Hello \n!"); Link to comment https://forums.phpfreaks.com/topic/92549-remove-line-breaks-from-form/#findComment-474240 Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 Would that work even if theres no \n apparent in the database? ex: this is my value thats would be trim() or the \n replace? Link to comment https://forums.phpfreaks.com/topic/92549-remove-line-breaks-from-form/#findComment-474262 Share on other sites More sharing options...
Northern Flame Posted February 23, 2008 Share Posted February 23, 2008 both examples will work, and the \n doesnt have to be in the database because it represents a line break so when you tell PHP to look for \n it doesnt look for those characters it looks for a line break Link to comment https://forums.phpfreaks.com/topic/92549-remove-line-breaks-from-form/#findComment-474270 Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 thats great thx :-) Link to comment https://forums.phpfreaks.com/topic/92549-remove-line-breaks-from-form/#findComment-474392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.