ammonkc
I'm trying to make a simple email form in php that can accept html tags. But I'm having trouble with this. the html tags inserted into the form by the user screws up my php and html tags. this is the function that creates the headers and sends out the email.
This actaully works as expected with all html tags. but the problem that I'm having is that I need to display a preview of the messege before I send it. I'm saving the subject and messege body in a hidden form variable. then when the user hits 'send' on the preview page, it should send, but the form and the tags get screwed up here on the preview page. the problem is that I have tags inside the messege body text, and that is conflicting with the page tags. Is there any way to hold a string variable with html tags on this intermediate preview page without screwing everything else up?
| Code: |
| function email($user_email) {
$from = "email@domain.net"; $headers = "From: $from\n"; $headers .= "Content-type: text/html; charset=iso-8859-1"; $msg_body = '<html><body><img src="http://mypage.net/images/image.jpg"><p>'; $msg_body .= '<div style="border:grey 1px solid; margin:0 auto; width:500px; padding:15px; font-size:14px;">'; $msg_body .= "<p>".nl2br(stripslashes($_REQUEST['messege']))."</p>"; $msg_body .= "</div></p></body></html>"; /**** send email out ****/ mail($user_email,$_REQUEST['subject'],$msg_body,$headers); }//end email() function |
This actaully works as expected with all html tags. but the problem that I'm having is that I need to display a preview of the messege before I send it. I'm saving the subject and messege body in a hidden form variable. then when the user hits 'send' on the preview page, it should send, but the form and the tags get screwed up here on the preview page. the problem is that I have tags inside the messege body text, and that is conflicting with the page tags. Is there any way to hold a string variable with html tags on this intermediate preview page without screwing everything else up?
