0

I want to be able to send form data from my website to my email with php. However, I tried all of the examples online and none of them worked for me. I don't know why. Am I missing a plugin?

    <form class="formmargin" id="email-form" action="send_form_email.php" method="post" target="iframe_dbcpmgmy" onsubmit="sent_dbcpmgmy = true" enctype="multipart/form-data">
                <div style="float:left; width:50%; padding-right:2.5%">
                    <label for="name">Name:</label>
                    <input class="w-input" type="text" name="name" placeholder="Enter your name" id="name" required="required" data-name="Name">
                    <label for="company_name">Company Name:</label>
                    <input class="w-input" type="text" name="company_name" placeholder="Enter your company name" id="company_name" required="required" data-name="Company Name">
                </div>
                <div style="float:left; width:50%; padding-left:2.5%">
                    <label for="email_address">Email Address:</label>
                    <input class="w-input" type="email" name="email_address" placeholder="Enter your email address" id="email_address" required="required" data-name="Email Address">
                    <label for="phone_number">Phone Number:</label>
                    <input class="w-input" type="text" name="phone_number" placeholder="Enter your phone number" id="phone_number" required="required" data-name="Phone Number">
                    <label for="uploaded_file">Upload a file (Optional)</label>
                    <input type="file" name="uploaded_file" id="uploaded_file">
                </div>
                <input style="clear:both" type="submit" name="submit" value="Submit" class="submitbutton">
            </form>

can someone tell me what i should put in the send_form_email.php file?

1 Answers1

0

You will want to create a second page getting all of the post information then you will want to use the php mail function.

If you haven't already created the post variables they will look like this

$name = $_POST['name'];
$company = $_POST['company_name'];
$to = $_POST['email_address'];

If you want to format it to have new lines in the message, because by default it will be one huge line use \n as no html/css formatting will work easily

mail ($to , $subject , $message );
Tyler H
  • 89
  • 2
  • 12