PDA

View Full Version : Splitting text into seperate lines.. How?!



woody
March 19th, 2001, 20:33
Maybe this is a stupid question, but I am new at this..
When I receive the info in my inbox from a form, all of the fields get printed out in one sentence (same line) how do I separate the fields in my received message? I know I've got to use <br> tags (I think) but where?!
Here's my code for the script..

# This script:
#
# - Takes the form contents
# - Saves the message into a temporary file
# - Calls Blat to send the mail
#


# Use the cgi unit
use cgi;

# Get the values from the form
$form = new CGI;
$sname=$form->param('sendername');
$saddr=$form->param('senderaddr');
$rname=$form->param('email');
$raddr=$form->param('recipientaddr');
$subject=$form->param('subject');
$refco=$form->param('refcode');

$server="smtp.fasthosts.co.uk";
$message=$form->param('message');
$sname=$form->param('sendername');
$saddr=$form->param('senderaddr');
$subject=$form->param('subject');
$refco=$form->param('refcode');

$lt='<';
$gt='>';

# Output the correct header
print "Content-type: text/html\n\n";

# Save the message into a text file
open (messtxt,">message.txt");
print messtxt ($message);
print messtxt ($refco);
close messtxt;

# Build the Blat command line and execute it
$blat="blat.exe message.txt -s \"$subject\" -t \"$lt$raddr$gt$rname\" -server $server -f \"$lt$saddr$gt$sname\"";

system($blat);

print $blat;
print "<br><br>Thanks for filling out this form.<br><br><BODY BGCOLOR=#FFFFCC>";
print "Mail sent to $raddr.";

Hope someone can help ;-)
woody

Cheap Bastard
March 19th, 2001, 21:05
i'm a newbie, but you might wanna try printing a \n whenever you want a new line.

woody
March 20th, 2001, 04:59
Nope, tried that (unless I'm not inserting the \n in the right place).
Any other suggestions. this problem's really pissing me off!