i am having a problem in sending mail to my server. i dont know why the problem is occurring? everything is done perfect but it is not working maybe the fields are not filling properly and alert message is also not shown
if(isset($_POST['uname']) && isset($_POST['fname']) && isset($_POST['nic']) && isset($_POST['pecno'])&& isset($_POST['quality[25]'])&& isset($_POST['bday'])&& isset($_POST['quality[26]'])&& isset($_POST['postal'])&& isset($_POST['cell'])&& isset($_POST['houseno'])&& isset($_POST['mail'])&& isset($_POST['city'])&& isset($_POST['province'])&& isset($_POST['country']) )
{
$_Name = $_POST['uname'];
$_Fname = $_POST['fname'];
$_NIC = $_POST['nic'];
$_Pecno = $_POST['pecno'];
$_Gender = $_POST['quality[25]'];
$_Bday = $_POST['bday'];
$_Qualification = $_POST['quality[26]'];
$_Postal = $_POST['postal'];
$_Cell = $_POST['cell'];
$_Houseno = $_POST['houseno'];
$_Email = $_POST['mail'];
$_City = $_POST['city'];
$_Province = $_POST['province'];
$_Country = $_POST['country'];
if(!empty($_Name) && !empty($_Fname) && !empty($_NIC) && !empty($_Pecno)&& !empty($_Gender)&& !empty($_Bday)&& !empty($_Qualification)&& !empty($_Postal)&& !empty($_Cell)&& !empty($_Houseno)&& !empty($_Email)&& !empty($_City)&& !empty($_Province)&& !empty($_Country))
{
$to = 'info#mymail.com';
$subject = 'Join us mail';
$body = 'Sender Name : '.$_Name."\n".'Sender Father Name : '.$_Fname."\n".'Sender NIC : '.$_NIC."\n".'Sender PEC Number : '.$_Pecno."\n".'Sender Gender : '.$_Gender."\n".'Sender Birthday : '.$_Bday."\n".'Sender Qualification : '.$_Qualification."\n".'Sender Postal Address : '.$_Postal."\n".'Sender Cell Number : '.$_Cell."\n".'Sender House Number : '.$_Houseno."\n".'Sender Email : '.$_Email."\n".'Sender City : '.$_City."\n".'Sender Province : '.$_Province."\n".'Sender Country : '.$_Country;
$header = 'From : '.$_Email;
if(#mail($to, $subject, $body, $header))
{
echo '<script language="javascript">';
echo 'alert("message successfully sent")';
echo '</script>';
}else
{
echo 'Please Try again in a few mints !';
}
}
}
html code
<form method="POST" action="index.php">
<div class="row">
<div class="col-sm-6 form-group">
<input class="form-control" id="uname" name="uname" placeholder="Name" type="text" required>
</div>
<div class="col-sm-6 form-group">
<input class="form-control" id="fname" name="fname" placeholder="Father Name" type="text" required>
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group">
<input class="form-control" id="nic" name="nic" placeholder="CNIC/Passport Number" type="text" required>
</div>
<div class="col-sm-6 form-group">
<input class="form-control" id="pecno" name="pecno" placeholder="PEC Number" type="text">
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group">
<input class="form-control" id="designation" name="designation" placeholder="Designation" type="text" required>
</div>
<div class="col-sm-6 form-group">
<input class="form-control" id="organization" name="organization" placeholder="Organization" type="text">
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group">
Gender: <div class="btn-group" data-toggle="buttons">
<label class="btn btn-default">
<input type="radio" id="quality[25]" name="quality[25]" value="1" /> Male
</label>
<label class="btn btn-default">
<input type="radio" id="quality[25]" name="quality[25]" value="2" /> Female
</label>
</div>
</div>
<div class="col-sm-6 form-group">
<input class="form-control" type="text" onfocus="(this.type='date')" id="bday" name="bday" placeholder="Date of Birth" ><br>
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group">
Qualification: <div class="btn-group" data-toggle="buttons">
<label class="btn btn-default">
<input type="radio" id="quality[26]" name="quality[26]" value="1" /> Bachelors In Engineering
</label>
<label class="btn btn-default">
<input type="radio" id="quality[26]" name="quality[26]" value="2" /> Masters
</label>
<label class="btn btn-default">
<input type="radio" id="quality[26]" name="quality[26]" value="3" /> PhD
</label>
</div>
</div>
<div class="col-sm-6 form-group">
<input class="form-control" id="postal" name="postal" placeholder="Postal Address" type="text" >
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group">
<input class="form-control slideanim" id="cell" name="cell" placeholder="Cell Number" type="tel" required>
</div>
<div class="col-sm-6 form-group">
<input class="form-control" id="houseno" name="houseno" placeholder="House Number" type="tel" required>
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group">
<input class="form-control slideanim" id="mail" name="mail" placeholder="Email Address" type="email" required>
</div>
<div class="col-sm-6 form-group">
<input class="form-control" id="city" name="city" placeholder="City" type="text" required>
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group">
<input class="form-control" id="province" name="province" placeholder="Province/State" type="text" required>
</div>
<div class="col-sm-6 form-group">
<input class="form-control" id="country" name="country" placeholder="Country" type="text" required>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-12 form-group">
<button class="btn btn-default pull-right " type="submit">Send</button>
</div>
</div>
</div>
replace #mail with mail
if(#mail($to, $subject, $body, $header))
enable error reporting
error_reporting(E_ALL);
Show last error with:
print_r(error_get_last());
and check php_error.log for a problem
phpinfo();
for checking if mail module is enabled in php.
If all pass, check /var/log/mail about the messages, here could be 1001 issues with network, server, firewall etc...
hope it helps.
As you mentioned that same code is working perfectly on other page so please check it by removing "#" from mail as adding this will hide all notices and it will display error as well. Also try to print mail body text before mail function.
Related
I am a beginner in web development, I used have an html elements, like textbox and other type of elements, I want to use them as my object and when they have a value and click a button, it will save the value of all the elements in mysql.
I have a code like this, but it cannot be inserted and anything does not happen when clicking a button.
Please help.
PHP:
<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_DATABASE', 'ytp');
$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
if(!$db ) {
die('Could not connect: ' . mysqli_error());
}
$fname = "";
$mname = "";
$lname = "";
$funame = "";
$cnum = "";
$bday = "";
$age = "";
$add = "";
if (isset($_POST['submit'])){
$fname = $_POST['fName'];
$mname = $_POST['mName'];
$lname = $_POST['lName'];
$funame = $_POST['fuName'];
$cnum = $_POST['Cnumber'];
$bday = $_POST['bday'];
$age = $_POST['age'];
$add = $_POST["address"];
}
$sql = "INSERT INTO employee ".
"(fName,mName,lName,fuName,cNumber,bDay,Age,Address) ".
"VALUES ('$fname','$mname','$lname','$funame','$cnum','$bday','$age','$add' )";
if (! mysqli_query($db , $sql)){
echo 'Cannot Insert';
}
else{
echo 'Success';
}
?>
HTML:
<div class="content">
<div class="row">
<div class="col-md-10">
<div class="card">
<div class="card-header">
<h5 class="title">Add User Information</h5>
</div>
<div class="card-body">
<form method="POST" action="php_functions\saveEmployee.php" name="INSERT">
<div class="row">
<div class="col-md-5 pr-md-1">
<div class="form-group">
<label>Company (disabled)</label>
<input type="text" class="form-control" disabled="" placeholder="Company" value="Benchmark Valuer's Inc.">
</div>
</div>
<div class="col-md-3 px-md-1">
<div class="form-group">
<label>ID</label>
<input type="text" class="form-control" placeholder="User ID" value="" id="id" name ="id" disabled>
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" placeholder="s.sample#gmail.com" id="email" name ="email">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 pr-md-1">
<div class="form-group">
<label>First Name</label>
<input type="text" class="form-control" placeholder="First Name" id="fName" name ="fName">
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label>Middle Name</label>
<input type="text" class="form-control" placeholder="Middle Name" id="mName" name ="mName">
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label>Last Name</label>
<input type="text" class="form-control" placeholder="Last Name" id="lName" name ="lName">
</div>
</div>
<div class="col-md-4 pl-md-1" hidden>
<div class="form-group">
<label>Fullname</label>
<input type="text" class="form-control" placeholder="Full Name" id="fuName" name ="fuName">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 pr-md-1">
<div class="form-group">
<label>Contact Number</label>
<input type="tel" class="form-control" placeholder="Contact Number" id="Cnumber" name="Cnumber">
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label>Age</label>
<input type="number" class="form-control" placeholder="Age" id="age" name="age">
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label>Birthday</label>
<input type="date" class="form-control" placeholder="Birthday" id="bday" name="bday">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Address</label>
<input type="text" class="form-control" placeholder="Home Address" id="address" name ="address">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 pr-md-1">
<div class="form-group">
<label>Username</label>
<input type="text" class="form-control" placeholder="Username" id="uName">
</div>
</div>
<div class="col-md-4 px-md-1">
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" placeholder="Password" id="pWord">
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label>UserType</label>
<input type="number" class="form-control" placeholder="0" id="uType">
</div>
</div>
</div>
<div class="row" hidden>
<div class="col-md-12">
<div class="form-group">
<label>Image Path:</label>
<input type="text" class="form-control" placeholder="C:\\" id="imageURL">
</div>
</div>
</div>
</form>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-fill btn-primary" id="submit" name="submit">Save</button>
<button class="btn btn-fill btn-success" id="btnBrowse">Browse</button>
<button class="btn btn-fill btn-danger" id="btnCancel">Cancel</button>
</div>
</div>
</div>
</div>
</div>
Your HTML form is closing before submit button. You should close that after submit button and also need to manage hierarchy of opening form tag as below:
<form method="POST" action="php_functions\saveEmployee.php" name="INSERT">
<div class="card-body">
<div class="row">
<div class="col-md-5 pr-md-1">
<div class="form-group">
<label>Company (disabled)</label>
<input type="text" class="form-control" disabled="" placeholder="Company" value="Benchmark Valuer's Inc.">
</div>
</div>
<div class="col-md-3 px-md-1">
<div class="form-group">
<label>ID</label>
<input type="text" class="form-control" placeholder="User ID" value="" id="id" name ="id" disabled>
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" placeholder="s.sample#gmail.com" id="email" name ="email">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 pr-md-1">
<div class="form-group">
<label>First Name</label>
<input type="text" class="form-control" placeholder="First Name" id="fName" name ="fName">
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label>Middle Name</label>
<input type="text" class="form-control" placeholder="Middle Name" id="mName" name ="mName">
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label>Last Name</label>
<input type="text" class="form-control" placeholder="Last Name" id="lName" name ="lName">
</div>
</div>
<div class="col-md-4 pl-md-1" hidden>
<div class="form-group">
<label>Fullname</label>
<input type="text" class="form-control" placeholder="Full Name" id="fuName" name ="fuName">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 pr-md-1">
<div class="form-group">
<label>Contact Number</label>
<input type="tel" class="form-control" placeholder="Contact Number" id="Cnumber" name="Cnumber">
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label>Age</label>
<input type="number" class="form-control" placeholder="Age" id="age" name="age">
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label>Birthday</label>
<input type="date" class="form-control" placeholder="Birthday" id="bday" name="bday">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Address</label>
<input type="text" class="form-control" placeholder="Home Address" id="address" name ="address">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 pr-md-1">
<div class="form-group">
<label>Username</label>
<input type="text" class="form-control" placeholder="Username" id="uName">
</div>
</div>
<div class="col-md-4 px-md-1">
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" placeholder="Password" id="pWord">
</div>
</div>
<div class="col-md-4 pl-md-1">
<div class="form-group">
<label>UserType</label>
<input type="number" class="form-control" placeholder="0" id="uType">
</div>
</div>
</div>
<div class="row" hidden>
<div class="col-md-12">
<div class="form-group">
<label>Image Path:</label>
<input type="text" class="form-control" placeholder="C:\\" id="imageURL">
</div>
</div>
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-fill btn-primary" id="submit" name="submit">Save</button>
<button class="btn btn-fill btn-success" id="btnBrowse">Browse</button>
<button class="btn btn-fill btn-danger" id="btnCancel">Cancel</button>
</div>
</form>
Hope it helps you.
the form has been closed before the submit button.
the </form> tag should be placed after the <div class="card-footer">...</div>.
please try it. hope it will help.
Was trying to make a student register page but the data won't insert into database and there was no error message shown so i'm not sure where the problem is. Any help is appreciated!
Here's the code:
<form onsubmit="return Add_Validate()" class="form-horizontal" action="AddStudent.php" method="POST">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title"><i class="fa fa-plus"></i> Add Student</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-3 control-label">Student Name </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="Add_Student_Name" placeholder="Student Name" name="Student_Name1" autocomplete="off" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Gender </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<select class="form-control" id="Add_Student_Gender" name="Student_Gender1" required>
<option value="">~~SELECT~~</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div></div>
<div class="form-group">
<label class="col-sm-3 control-label">Address </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="Add_Student_Address" placeholder="Address" name="Student_Address1" autocomplete="off" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Contact Number </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="Add_Contact_Number" placeholder="Contact Number" name="Contact_Number1" autocomplete="off" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Email </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="Add_Student_Email" placeholder="Email" name="Student_Email1" autocomplete="off" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Faculty </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<select class="form-control" name="Add_Faculty1" id="FacultyName" required>
<option value="">~~SELECT~~</option>
<?php $query_faculty="SELECT FacultyName FROM `faculty`";
$result_faculty = mysqli_query($connect, $query_faculty) or die(mysqli_error($connect));
while($row_faculty=mysqli_fetch_array($result_faculty)) { ?>
<option value="<?php echo $row_faculty['FacultyName'] ?>"><?php echo $row_faculty['FacultyName'] ?></option>
<?php } ?></select></div></div>
<div class="form-group">
<label class="col-sm-3 control-label">Username </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="Add_Student_Username" placeholder="Username" name="Student_Username1" autocomplete="off" required>
</div></div>
<div class="form-group">
<label class="col-sm-3 control-label">Password </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="password" class="form-control" id="Add_Password" placeholder="Password" name="Student_Password1" autocomplete="off" required>
</div>
</div>
And SQL command:
<?php require 'php_action/db_connect.php';
if($_POST) {
$Student_Name= $_POST['Student_Name1'];
$Student_Gender= $_POST['Student_Gender1'];
$Student_Address= $_POST['Student_Address1'];
$Contact_Number= $_POST['Contact_Number1'];
$Student_Email= $_POST['Student_Email1'];
$FacultyName= $_POST['Add_Faculty1'];
$Student_Username= $_POST['Student_Username1'];
$Password= $_POST['Student_Password1'];
$sql = "INSERT INTO student (Student_Name,Student_Gender,Student_Address,Contact_Number,Student_Email,FacultyName,Student_Username,Password) VALUES ('$Student_Name', '$Student_Gender','$Student_Address','$Contact_Number','$Student_Email','$FacultyName','$Student_Username','$Password')";
if($connect->query($sql) === TRUE) {
echo "<SCRIPT>alert('Student successfully added!');document.location='Student_Register.php'</SCRIPT>";
}
else {
echo "<SCRIPT>alert('Student add unsuccessful!');document.location='Student_Register.php'</SCRIPT>";
}
}
$connect->close();
?>
Found the error, seems to be wrong column name, sorry the all the trouble.....
Admin please close my question.
You're not getting an error message because you never get the error message from MySQL and show it in your alert. $connect->error will contain the error message, and you can add that to your alert like this:
else {
echo "<SCRIPT>alert('Student add unsuccessful! Reason: ' + " . json_encode($connect->error) . ");document.location='Student_Register.php'</SCRIPT>";
}
After having read the documentation for wp_mail several times and looking around for solutions, i still haven't been able to figure out how to get a file attached with wp_mail();
First of all, i'm of the understanding that the file path is needed, but how do i know where it is saved on my wordpress site? And when it is is saved, is it temporary or permanently?
Currently i'm just using $attachments = array(WP_PLUGIN_DIR . '/uploads/file_to_attach.zip');
because i saw it in another post on stackoverflow. But this means that i'm not using my $_POST['file']
in which the path should be stored.
HTML
<form method="post" role="form" action=''>
<div class="col-xs-12 col-sm-6 form-group">
<label>Navn</label>
<input class="form-control" name="name" type="text" value="<?php echo $_POST['name']; ?>" required/>
</div>
<div class="col-xs-12 col-sm-6 form-group">
<label>E-mail</label>
<input class="form-control" name="email" type="email" value="<?php echo $_POST['email']; ?>" required/>
</div>
<div class="col-xs-12 col-sm-6 form-group">
<label>Tlf.</label>
<input class="form-control" name="phone" type="tel" value="<?php echo $_POST['phone']; ?>" required/>
</div>
<div class="col-xs-12 col-sm-6 form-group">
<label>Firma</label>
<input class="form-control" name="company" type="text" value="<?php echo $_POST['company']; ?>" />
</div>
<div class="col-xs-12 form-group">
<label>Besked</label>
<textarea class="form-control" name="message" type="text" rows="6" required><?php echo $_POST['message']; ?></textarea>
</div>
<div class="col-xs-12 form-group">
<div class="input-group">
<label class="input-group-btn">
<span class="btn btn-primary">
Vedhæft billeder… <input type="file" name="file" style="display: none;" multiple>
</span>
</label>
<input type="text" class="form-control" readonly>
</div>
</div>
<div class="col-xs-12" id="checkrow">
<label>
<input type="checkbox" name="check" required> Jeg er et menneske
</label>
</div>
<div class="col-xs-4 form-group" style="padding-top:1rem;">
<input id="submit" name="submit" type="submit" value="Send" class="btn btn-primary" style="min-width:5rem">
</div>
<?php echo $result; ?>
</form>
PHP
$to = "ch#ap-pe.dk";
$msg = "Navn: ".$_POST['name']."
Email: ".$_POST['email']."
Tlf: ".$_POST['phone']."
Firma: ".$_POST['company']."
Besked: ".$_POST['message'];
$msg = wordwrap($msg, 70);
$headers = 'From: ';
$attachments = array(WP_PLUGIN_DIR . '/uploads/file_to_attach.zip');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (!$_POST['name']){
$errorMsg="Indtast navn";
}
if (!$_POST['email']){
$errorMsg.="Indtast email";
}
if (!$_POST['message']){
$errorMsg.="Indtast besked";
}
if (!$_POST['check']){
$errorMsg.="Bekræft at du er menneske";
}
$result = "Ret følgende fejl: $errorMsg";
wp_mail($to, "Kontakt Besked",$msg, $headers, $attachments);
}
?>
I've made a contact form for my website, included the html and the php, it does send an email which does show "name: email: message:" but after that it's empty, so it doesn't show what you type in the form, please help!
Here is the html:
<form action="thankyou.php" method="post">
<div class="col-md-5" style="margin-top:15px;">
<div class="form-group">
<label for="contact-name" class="col-sm-2 control-label">Naam</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="contact-name" placeholder="First & Last name" />
</div>
</div>
<div class="form-group">
<label for="contact-email" class="col-sm-2 control-label" style="margin-top:15px;">Email</label>
<div class="col-sm-10" style="margin-top:15px;">
<input type="text" class="form-control" id="contact-name" placeholder="example#domain.com" />
</div>
</div>
<div class="form-group">
<label for="contact-message" class="col-sm-2 control-label" style="margin-top:15px;">Message</label>
<div class="col-sm-10" style="margin-top:15px;">
<textarea class="form-control" rows="4"></textarea>
</div>
</div>
<button style="btn-align:center; margin-left:88px; margin-top:15px;" type="submit" class="btn btn-primary">Verstuur</button>
</div>
</div>
</div>
</form>
Here is the php:
<?
$name = $_POST['contact-name'];
$email = $_POST['contact-email'];
$message = $_POST['contact-message'];
$email_message = "
Name:".$name."
Email:".$email."
Message:".$message."
";
mail ( "email#example.com" , "New inquiry", $email_message);
?>
Your form fields are all missing the name attribute. Without it that data is not sent.
<input type="text" class="form-control" name="contact-name" id="contact-name" placeholder="First & Last name" />
^^^^
This is missing for all form fields
I Have two forms on my site. One works fine and the other sends email with email_from: etc but doesn't capture any of the form data.
Wondering what it may be. I can post the form that is working along with it's html too if that would help debug. Very much a novice and built form using stack overflow/other sites.
Coffee
<div class="form-group">
<label class="col-sm-3 control-label">Quantity</label>
<div class="col-sm-4">
<input type="text" name="quantity" class="form-control" placeholder="Quantity : " required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Name</label>
<div class="col-sm-6">
<input type="text" name="name" class="form-control" placeholder="Name : " required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Email address</label>
<div class="col-sm-6">
<input type="email" name="email" class="form-control" placeholder="Email address : " required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Shipping Address</label>
<div class="col-sm-6">
<textarea class="form-control" name="shipping_address" rows="8" placeholder="Shipping Address : " required></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Payment Method</label>
<div class="col-sm-6">
<select class="form-control" required>
<option value="Paypal">Paypal</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Notes</label>
<div class="col-sm-6">
<textarea class="form-control" name="notes" rows="8" placeholder="Notes : "></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-10">
<button type="submit" class="btn btn-black">Order Now</button></a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
And here is the php
<?php
if(isset($_POST ['submit']))
{
$coffee = ($_POST['coffee']));
$quantity = ($_POST['quantity']));
$name = ($_POST['name']));
$email = ($_POST['email']));
$shipping_address = ($_POST['shipping_address']));
$notes = ($_POST['notes']));
}
$email_from ='paradigmcoffee#gmail.com';
$email_subject="New Order Submission";
$email_body ="You have received a new message from user $name.\n".
"Email_address:$email\n".
"Coffee: $coffee\n".
"Quantity: $quantity\n".
"Shipping_Address: $shipping_address\n".
"Notes: $notes\n".
$to ="paradigmcoffee#gmail.com";
$headers = "From: $email \r\n";
mail($to,$email_from,$email_subject,$email_body,$headers);
header("Location: http://www.paradigmcoffee.co/order_thanks.html");
?>
From what you have supplied, likely the reason you can not get data is because you are not sending anything called submit. Try naming your button:
<!-- name="submit" added -->
<button name="submit" type="submit" class="btn btn-black">Order Now</button>
You can do this or make a hidden field:
<input type="hidden" name="submit" value="1" />