logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 06-10-2009, 01:51 PM   #1
miamikrock
 
Join Date: Jun 2009
Posts: 18
Default form email php Bare LFs

I'm having trouble with the form being emailed, I get an error saying I have bare LFs, the error said it was on line 39. I used the php tutorial from dreamweaver club.



<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Results from Contact form';

// Your email address. This is where the form information will be sent.
$emailadd = 'drgreenthumblawns@hotmail.com';

// Where to redirect after form is processed.
$url = 'http://greenthumblandscapingservice.com/contactconfirmation.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '1';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
miamikrock is offline   Reply With Quote
Old 06-10-2009, 08:02 PM   #2
MagicPower
 
Join Date: Jun 2009
Posts: 120
Default

bare linefeed (BARE LF) may be or is in the email body. some email servers or your web hosting sever doesn't allow BARE LF. for more infoe: http://cr.yp.to/docs/smtplf.html

Last edited by MagicPower; 06-10-2009 at 08:07 PM..
MagicPower is offline   Reply With Quote
Old 06-10-2009, 08:23 PM   #3
miamikrock
 
Join Date: Jun 2009
Posts: 18
Default

I've already been to that site, it didn't help me remedy the problem.
miamikrock is offline   Reply With Quote
Old 06-10-2009, 09:28 PM   #4
MagicPower
 
Join Date: Jun 2009
Posts: 120
Default

i read some where that if you can edit the email body, you can fix the issue by replacing bare LF with CRLF. May i suggest Lightform its a free ajax/php contact form. i used it for my site check it out. if you are in any doubt if it works or not mail me off my site n i'll tell you ur message.
MagicPower is offline   Reply With Quote
Old 06-10-2009, 09:55 PM   #5
miamikrock
 
Join Date: Jun 2009
Posts: 18
Default

I don't doubt you I just want to fix the php script. Can you paste the script here?
miamikrock is offline   Reply With Quote
Old 06-10-2009, 10:06 PM   #6
MagicPower
 
Join Date: Jun 2009
Posts: 120
Default

i'm not a php scripter, i can try my best to help you. have you got this file class.usermailer.php
MagicPower is offline   Reply With Quote
Old 06-10-2009, 10:21 PM   #7
miamikrock
 
Join Date: Jun 2009
Posts: 18
Default

no I do not.
miamikrock is offline   Reply With Quote
Old 06-11-2009, 12:36 AM   #8
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,202
Default

try replacing
Code:
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
with
Code:
mail($emailadd, $subject, $text, 'From: '.$emailadd);
header( 'Location: 'http://greenthumblandscapingservice....firmation.html'  ) ;
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 06-11-2009, 02:03 AM   #9
miamikrock
 
Join Date: Jun 2009
Posts: 18
Default

when I replaced the code, this is the error I recieved:

Parse error: syntax error, unexpected T_STRING
on line 40

Line 40 is:

header( 'Location: 'http://greenthumblandscapingservice.com/contactconfirmation.html' ) ;
miamikrock is offline   Reply With Quote
Old 06-11-2009, 03:36 AM   #10
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,202
Default

ok just to try debugging, comment it out. that will disable the redirect for now. and try if mail is being sent
//header( 'Location: 'http://greenthumblandscapingservice....firmation.html' ) ;
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:11 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com