JSHINER Posted February 12, 2007 Share Posted February 12, 2007 When I use echo <<<END $field END; It displays this example: ------------------ Text "goes" here. More text. ------------------- LIKE THIS ------------------- Text \"goes\" here. More text. ------------------- Is there anything I can do to fix this? Quote Link to comment Share on other sites More sharing options...
trq Posted February 12, 2007 Share Posted February 12, 2007 What is the problem? Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 12, 2007 Author Share Posted February 12, 2007 I need it to diplay as it was entered in the scrolling text box. I need it to recognize the paragrahs, and not put \ before " Quote Link to comment Share on other sites More sharing options...
trq Posted February 12, 2007 Share Posted February 12, 2007 Take a look at nl2br() and stripslashes(). Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 12, 2007 Author Share Posted February 12, 2007 Ok that works for displaying on the page. But when the user hits NEXT to send to me (I receive via email) ... If I type in the form --- Testing "test" All I get in the email from the user is --- Testing \ This is what sends the information to me: ---------------------- msgtxt = " $field1 $field2 "; $header = "To: ".$order_email."\n"; $header .= "From: ".$order_email."\r\n"; $mailresult = @mail("",$subject,$msgtxt,$header); ---------------------- How can I make it so the $field1 will send ALL info regardless of whether or not there are " or ' in it. Any help is much appreciated! Thanks! Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 12, 2007 Share Posted February 12, 2007 Here you go a little gift. <?php $email_address="what the email address is ?"; $to = $email_address; $subject = 'what the subject is ?'; $message = '<html><body> <table align='center'><tr><td align='center'> The message here </tr></td></table></body></html>; $your_email_address="your email"; $headers = "From: $your_email_address\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send if(mail($to, $subject, $message, $headers)){ echo " your mail was sent"; exit; }else{ echo " no mail sent"; exit; } ?> Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 13, 2007 Author Share Posted February 13, 2007 Thank you - That works great EXCEPT I have a form - lets call the "your message" field "field1" When I put for a message in field1 (scrolling text box) ------------------- This is a test It isn't "working" yet. ------------------- I use: $field1s = stripslashes(nl2br($field1)); I have it added to the $message = as '.$field1s.' I get this as an email: ------------------- This is a test It isn\'t -------------------- It adds \ in front of all ' and does not display anything in " " or after them. Any help would be much appreciated.. Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 13, 2007 Author Share Posted February 13, 2007 I have searched everywhere on those two links and can not find the proper solution to strip " " - am I missing it ? Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 redarrow's code has several mistakes in it - can we see the actual code you're using? Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 13, 2007 Author Share Posted February 13, 2007 It is a bit lenghty, so I wont paste it all - but I have a form that asks for a few fields, one of them being "desc" which is a scrolling text box. When you click submit, it goes to a "Preview" page where it displays the form results to be checked, with another form using hidden fields, one being: <input type="hidden" name="desc" value="'.$desc.'"> When you click submit on the preview page, it finally goes here: $email_address = "jshiner@northie.com"; $to = $email_address; $subject = 'NEW SIGN UP'; $descfin = stripslashes(nl2br($desc)); $message = '<html><body> <table align=center><tr><td align=center> '.$descfin.' </tr></td></table></body></html>'; $your_email_address="james@dailyhomeowner.com"; $headers = "From: $your_email_address\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; if(mail($to, $subject, $message, $headers)){ Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 Okay try this and let me know what you get: $to = 'jshiner@northie.com'; $subject = 'NEW SIGN UP'; if(get_magic_quotes_gpc()){ $descfin = stripslashes(nl2br($_POST['desc'])); }else{ $descfin = nl2br($_POST['desc']); } $message = "<html><body>$descfin</body></html>"; $from = 'james@dailyhomeowner.com'; $headers = "From: $from\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; mail($to, $subject, $message, $headers); Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 13, 2007 Author Share Posted February 13, 2007 When I enter: This is a "test" - for $desc, I get: This is a \ - in the email. When I enter: This isn't working - for $desc, I get: This isn\'t working - in the email ... So same problem. Any ideas? Thank you for the help ! Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 Are you adding slashes anywhere via mysql_real_escape_string or addslashes()? Change the if statement I wrote to just this: $descfin = stripslashes(nl2br($_POST['desc'])); I know it's what you had before, but since we changed the quotes on the email maybe that helped... *shrug* Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 13, 2007 Author Share Posted February 13, 2007 I changed the IF statement to: if(get_magic_quotes_gpc()){ $descfin = stripslashes(nl2br($_POST['desc'])); } Still having the same issue... Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 13, 2007 Author Share Posted February 13, 2007 Also tried just: $descfin = stripslashes(nl2br($_POST['desc'])); Same results. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 try $descfin = stripslashes(stripslashes(nl2br($_POST['desc']))); Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 13, 2007 Author Share Posted February 13, 2007 Ok we got the isn\'t problem fixed. Still kills anything in " " and after. This isn't working - displays fine. This isn't "working" - only displays: This isn't 1 down, 1 to go. Any suggestions? Thanks again for all the help. I reall appreciate it. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 I dunno this is really weird. Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 13, 2007 Author Share Posted February 13, 2007 When I add another field such as: $message = "<html><body>$descfin<br>$category</body></html>"; And enter: ------------------ $desc = This is a "test" It isn't working $category = Test Cat ------------------ The email I get is: ------------------ This is a Test Cat ------------------ So the problem is in the $desc - It does not completely kill the message - just the text inside of an after " " in $desc. Really weird. Never seen this problem before. Any suggestions would be much appreciated . . . I am stuck. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 You can try stripping out the quotes using str_replace $desc str_replace('"', "'", $desc); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.