Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2011
    Posts
    118
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Sending user entered data as form in mail

    Hi All,

    I have a form where user enters the data and after he clicks on submit button it will go to an email id. I want to send these data as a form. I am not getting how to do this. No i have written code like this and in mail i receive data as one after other

    Code:
    $MailToAddress = "emailid"; 
    $redirectURL = "http://www....success=true"; 
    $MailSubject = "User - Details"; 
    
    $redirectURL = "http://www....success=true";
    $message_body = "Key Phrase 1: ".$_POST["name1"]."\r\n"; 
    $message_body .= "Key Phrase 2: ".$_POST["name2"]."\r\n";
    $message_body .= "Key Phrase 3: ".$_POST["name3"]."\r\n";
    $message_body .= "URL 1: ".$_POST["url1"]."\r\n"; 
    $message_body .= "URL 2: ".$_POST["url2"]."\r\n";
    $message_body .= "URL 3: ".$_POST["url3"]."\r\n";
    $message_body .= "Inner Page 1: ".$_POST["inner1"]."\r\n";
    $message_body .= "Inner Page 2: ".$_POST["inner2"]."\r\n";
    $message_body .= "Inner Page 3: ".$_POST["inner3"]."\r\n";
    $message_body .= "No of Key Phrase: ".$_POST["key"]."\r\n"; 
    
    
    $mailHeader = $name1;
    
    	if (!mail($MailToAddress, $MailSubject, $message_body, $mailMessage,$mailHeader)) { echo "Error sending e-mail!";}
    	else { header("Location: ".$redirectURL); }	
    
    ?>

  2. #2
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,206
    Thanks
    10
    Thanked 1,166 Times in 1,157 Posts
    Are you saying that you want the actual form sent as an email, not the form data?

    So if I got an email, I would see the form that I need to fill out?
    I'm not understanding the question.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •