Jump to content

Php Form Results Don't Make It To Inbox


scot

Recommended Posts

Hello,
When I submit my home-built php contact form (below) the information doesn't make it to my inbox - it just disappears. There's no error log and once I click the Submit button, it says the info was submitted successfully.
<form method="POST" action="mailer.php">
Name&#58; &nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="name" size="19"><br>
<br>
Company&#58;
<input type="text" name="company" size="19"><br>
<br>
e-Mail&#58; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="email" size="19"><br>
<br>
<input type="checkbox" name="check[]" value="digital_sample"> <b>Please send unrestricted digital access<br>
<input type="checkbox" name="check[]" value="physical_sample"> Reserve my physical, retail shipper pack</b><br><br>
<p style="text-align:center; font-family:Arial">
Shipping Instructions&#58;<br>
<textarea rows="9" name="message" cols="30"></textarea><br>
<br>
<input type="submit" value="Submit" name="submit"></p>
</form>

<?php
$check_msg = "";
if(isset($_POST['submit'])) {
$to = "contact@stopsmokingforgood.com";
$subject = "Sample Request";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$company_field = $_POST['company'];
$message = $_POST['message'];
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: ".$value;
}
$body = "From: ".$name_field.": E-Mail: ".$email_field." : Company: ".$company_field." : Message: ".$message." : ".$check_msg;
echo "Data has been submitted to ".$to;
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>

Link to comment
Share on other sites

This script is a bit mal-constructed.  YOu are outputting an html form but then your follow it with the php logic that means nothing UNTIL the form is submitted.  A good layout would be to have the php come first and the html come later.  Plus it is a bit out-dated.  And you are missing some headers for the email. 

Link to comment
Share on other sites

In addition to what was suggested above, from where are you serving this? Local Server or Remote? If it is a local server such as WAMP pr MAMP you might need to configure it so it picks up the php mail(). In MAMP it is not configured this way when first installed.

Link to comment
Share on other sites

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.