Gossamer Forum
Home : Products : DBMan : Customization :

Code to convert newline to ''

Quote Reply
Code to convert newline to ''
I am using Big Nose Bird's bnbform.cgi to gather input from users for a service request database and then automatically write it to the default.db file. In one of the fields, which is a textarea field for description of the problem, users can hit the enter key to add space. When DB Man gets a hold of the data it sees this as a newline and treats it as the start of a new record. Anyone know of the code that I could add to the bnbform.cgi script to convert the newline chars to ' ' (i.e. the same way that DB Man treats them)?

I have posted my bnbform.cgi here: http://www.csulb.edu/~jwg/bnbform.txt

Quote Reply
Re: Code to convert newline to '' In reply to
I guess in sub decode_vars, you could add:
Code:
$content =~ s/\n/<.br>/g;
after
Code:
$content =~ s/\t/ /g;
This will convert line breaks to HTML br tags (remove the . in <.br>)
or if you really want just blank space, use:
Code:
$content =~ s/\n/ /g;
--Drew