theredking Posted September 4, 2007 Share Posted September 4, 2007 I'm a little stuck. I am new to this, so it is undoubtedly down to something I clearly do not understand. I'm using mail() and am trying to email the contents of a form. I can do this successfully until I try and make what is emailed from that form a little more complicated. Right now I have: mail( "me@myemail.com", "This is a test", "Message goes here", "From:$first_name $last_name <$email>\r\nContent-type: text/html; charset=us-ascii"); This works as it should. In my "Message goes here", section I have listed the vars and text, as you might expect, and I am formatting it very basically with simple tags for line break, and strong text etc. The problem I have comes when I am trying to have it send the results of a number of checkboxes. I had a similar problem the other day, and when this problem arose I was offered this code: foreach ($_POST['checkboxname'] as $value) { echo "$value " ; } This worked fine, but I cannot get it to work within my page that has mail() in it. I'm sure this is not right, but I put this entire code inline where I wanted the checkbox array to be displayed. Should I put foreach ($_POST['checkboxname'] as $value) somewhere else, and then just reference the array with $value inside the mail() code with the other variables? I did try this, but it didn't work for some reason. My other thought was to escape out of "Message goes here", and just put html code in, but if I do this, I get no message content at all. I know I'm in over my head here, is there a solution? I'm slowly learning this... Thank you in anticipation... Quote Link to comment https://forums.phpfreaks.com/topic/67965-escaping-inside-mail-to-add-html/ 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.