BadEgg Posted April 24, 2008 Share Posted April 24, 2008 Ok guys my php knowledge is basically non existant, I have been using a feedback form on my website that i downloaded from something a long time ago - now while the form works fine to an extent the test in the message thats emailed does not have any line spacing, for example : If someone types into the box: Hello there my name is bob. I live on Mars. I like it there. (very random i know) In the actual email it will read as : Hello there my name is Bob. I live on Mars. I like it there. now while this fine for a few lines it really sucks when its 30/40 lines of text. So, can someone help me solve this most basic of problems? Here's the code <?php $mailto = 'admin@yoursite.com' ; $subject = "something or other" ; $name = $_POST['name'] ; $email = $_POST['email'] ; $url = $_POST['url']; $type = $_POST['mtype']; $message = $_POST['message'] ; $http_referrer = getenv( "HTTP_REFERER" ); if($name=="Your Name") echo("<html><head><title>koolOS - Fedback</title><script>function update(){history.go(-1);}var refresh=setInterval('update()',3000);</script></head><body onload=refresh><div align=center><center><table border=1pt cellpadding=0 cellspacing=0 style=border-collapse: collapse; bordercolor=#111111 bgcolor=#EBEBEB><tr><td><table border=0 cellpadding=3 cellspacing=0 style=border-collapse: collapse; bordercolor=#111111><tr><td><b><font color=#FF0000><font face=verdana size=2>Error: You Didn't Entered Your Name!</font></font></b></td></tr></table></td></tr></table></center></div><p align=center><font face=Verdana size=1 color=#666666>Please wait for a while..... You are being redirected! If not then click </font><a href=javascript: style=text-decoration: none><font face=Verdana size=1 color=#3399FF>here</font></a><font face=Verdana size=1 color=#666666>.</font></p><body></html>"); else if($email=="Your Email") echo("<html><head><title>koolOS - Fedback</title><script>function update(){history.go(-1);}var refresh=setInterval('update()',3000);</script></head><body onload=refresh><div align=center><center><table border=1pt cellpadding=0 cellspacing=0 style=border-collapse: collapse; bordercolor=#111111 bgcolor=#EBEBEB><tr><td><table border=0 cellpadding=3 cellspacing=0 style=border-collapse: collapse; bordercolor=#111111><tr><td><b><font color=#FF0000><font face=verdana size=2>Error: You Didn't Entered Your Email!</font></font></b></td></tr></table></td></tr></table></center></div><p align=center><font face=Verdana size=1 color=#666666>Please wait for a while..... You are being redirected! If not then click </font><a href=javascript: style=text-decoration: none><font face=Verdana size=1 color=#3399FF>here</font></a><font face=Verdana size=1 color=#666666>.</font></p><body></html>"); else if($message=="Type your message here!") echo("<html><head><title>koolOS - Fedback</title><script>function update(){history.go(-1);}var refresh=setInterval('update()',3000);</script></head><body onload=refresh><div align=center><center><table border=1pt cellpadding=0 cellspacing=0 style=border-collapse: collapse; bordercolor=#111111 bgcolor=#EBEBEB><tr><td><table border=0 cellpadding=3 cellspacing=0 style=border-collapse: collapse; bordercolor=#111111><tr><td><b><font color=#FF0000><font face=verdana size=2>Error: You Didn't Entered The Message!</font></font></b></td></tr></table></td></tr></table></center></div><p align=center><font face=Verdana size=1 color=#666666>Please wait for a while..... You are being redirected! If not then click </font><a href=javascript: style=text-decoration: none><font face=Verdana size=1 color=#3399FF>here</font></a><font face=Verdana size=1 color=#666666>.</font></p><body></html>"); else { $messageproper = "<table border=1 cellpadding=5 cellspacing=0 style=border-collapse: collapse bordercolor=#111111 bgcolor=#EBEBEB><tr><td>" . "<font face=verdana size=2 color=#000000><b>This message was sent from:</b><br> " . "<font color=#333333>$http_referrer<br><br>" . "<b>Name:</b> " . "<font color=#333333>$name<br>" . "<b>Email Address:</b> " . "<font color=#333333>$email<br>" . "<b>URL:</b> " . "<font color=#333333>$url<br>" . "<b>Message Type:</b> " . "<font color=#333333>$type<font></font><br><br>" . "<b>------------------------- Message -------------------------</b><br><br>" . $message . "<br><br><b>------------------------------------------------------------</b><br>" . "</td></tr></table>" ; if(mail($mailto, $subject, $messageproper,"MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1")) { echo("<html><head><title>koolOS - Fedback</title><script>function update(){top.location='news.php';}var refresh=setInterval('update()',3000);</script></head><body onload=refresh><div align=center><center><table border=1pt cellpadding=0 cellspacing=0 style=border-collapse: collapse; bordercolor=#111111 bgcolor=#EBEBEB><tr><td><table border=0 cellpadding=3 cellspacing=0 style=border-collapse: collapse; bordercolor=#111111><tr><td><b><font color=#006400><font face=verdana size=2>Message Was Sent Successfully!</font></font></b></td></tr></table></td></tr></table></center></div><p align=center><font face=Verdana size=1 color=#666666>Please wait for a while..... You are being redirected! If not then click </font><a href=javascript: style=text-decoration: none><font face=Verdana size=1 color=#3399FF>here</font></a><font face=Verdana size=1 color=#666666>.</font></p><body></html>"); } else { echo("<html><head><title>koolOS - Fedback</title><script>function update(){top.location='listing.php';}var refresh=setInterval('update()',3000);</script></head><body onload=refresh><div align=center><center><table border=1pt cellpadding=0 cellspacing=0 style=border-collapse: collapse; bordercolor=#111111 bgcolor=#EBEBEB><tr><td><table border=0 cellpadding=3 cellspacing=0 style=border-collapse: collapse; bordercolor=#111111><tr><td><b><font color=#FF0000><font face=verdana size=2>An Error Occured In mail()!</font></font></b></td></tr></table></td></tr></table></center></div><p align=center><font face=Verdana size=1 color=#666666>Please wait for a while..... You are being redirected! If not then click </font><a href=javascript: style=text-decoration: none><font face=Verdana size=1 color=#3399FF>here</font></a><font face=Verdana size=1 color=#666666>.</font></p><body></html>"); } } ?> Help will result in you being forever added to my Christmas card list Quote Link to comment https://forums.phpfreaks.com/topic/102738-such-a-n00b-problem-help-with-feedback-form-much-appreciated/ Share on other sites More sharing options...
tippy_102 Posted April 25, 2008 Share Posted April 25, 2008 nl2br - Returns string with '<br />' inserted before all newlines. http://ca3.php.net/nl2br Quote Link to comment https://forums.phpfreaks.com/topic/102738-such-a-n00b-problem-help-with-feedback-form-much-appreciated/#findComment-527411 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.