如何通过php电子邮件发送填写表格

I have a form in my website which the user fills in.After form validation I want to send that form as it is with values filled to mail(maybe HTML form or pdf).How am I supposed to do this?I know the basic in sending form using Php or Codeigniter but I don't know how to send the form as HTML form or Pdf.

You mean send the form as is via email?

In laravel framework, you can send a view(with your form) entirely by passing in a $view. I don't know about codeigniter, maybe they have this kind of function too?

I would use PHPMailer if I were you, since it has a very convenient interface and supports different secure protocols through socket. If you follow the mentioned link, you'll find a very descriptive example of usage. Now, you want to focus on these lines:

<?php

$mail = new PHPMailer;
// [...]
$mail->IsHTML(true);
// [...]
$mail->Body    = 'This is the HTML message body <b>in bold!</b>';

?>

I bet you can pass any string to the Body property. So just render your HTML form filled with values into a variable, then pass it to Body.

Well this is pretty easy with CI's Email Class

all you have to do is handle the post and then you can create a new view and pass the forms data through to it

$this->email->initialize($config);
$this->email->from('your@example.com', 'Your Name');
$this->email->to('someone@example.com');
$this->email->cc('another@another-example.com');
$this->email->bcc('them@their-example.com');

$this->email->subject('Email Test');
$data['form_post'] = $this->input->post();
$msg = $this->load->view('email/template',$data,true);
$this->email->message($msg); 
$this->email->alt_message('Something Should go here Else CI just takes the original and  strips the tags');
$this->email->send();

Try this:

#post your HTML form in a view say form.php
public function sendForm(){                 #the controller function
    if($this->input->post(null)){
        $postValues = $this->input->post(null); #retrieve all the post variables and send to form.php
        $form   = $this->load->view('form.php', $postValues, true); #retrieve the form as HTML and send via email
        $this->load->library('email');
        $this->email->from('your@example.com', 'Your Name');
        $this->email->to('someone@example.com'); 
        $this->email->subject('Email Test');
        $this->email->message($form);   
        $this->email->send();
    }
}