Jump to content

Recommended Posts

I have a couple of questions regarding forms processing.

 

I have a form that retrieves an e-mail address from my MySQL database. it is a simple form that has a text box for the subject field and a textarea for the message body.

 

Here is where one of my issues arises. When I type a message and I hit the return key to start a new paragraph it all looks OK in the textarea box, however when I send the e-mail it appears as one single line on the recipient's mail client.  how can I process the e-mail to send as it appears (to include the carriage returns) when entered. I have played with using the <BR> tag but that is cumbersome and I'm sure it may pose a problem on systems that display e-mails as text only.

 

Secondly, I am wanting to include a URL (http://www.whatever.com) in the e-mail and make it so when it is displayed on the email client, the person can merely click on the link as opposed to having to copy and paste it in the browser. I know this is probably a very simple fix but I am at a lost.

 

Thank in advance

 

Jester

Link to comment
https://forums.phpfreaks.com/topic/84891-form-processing-questions/
Share on other sites

Well for a link to be clickable, you have to send html emails.

 

Here is a script that I have not had any problems with at all.

 

<?php
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "X-Mailer: PHP/" .phpversion() ."\n";
$headers .= "From: $name <$email>";
$to='somebody@email.com';
$subject = 'WebForm Question From '. $name;
$body='';
mail($address , $subject, $body, $headers);
?>

 

 

You have to use \n  to get the line breaks in there properly. Or do it in HTML and use <br> tags.

 

Nate

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.