Vote count:
0
I cannot figure this out to save my life. I have tried and tried to fix this but I am not having nay luck.
The email gets sent but everything is blank and I cannot figure out why. All the variables in the email and the database are blank.
Any help would be greatly appreciated.
form
<form id="contact" name="contact" action="#" method="post" style="width:700px">
<input type="hidden" id="Form_ID" name="Form_ID" value="<?php echo $eid; ?>" />
<br />
<table width="90%">
<tr>
<td width="25%">*First Name:</td>
<td width="3%"> </td>
<td width="70%">
<input width="500" type="text" id="Form_FName" name="Form_FName" />
</td>
</tr>
<tr>
<td width="36%">*Last Name:</td>
<td width="3%"> </td>
<td width="61%">
<input type="text" id="Form_LName" name="Form_LName" />
</td>
</tr>
<tr>
<td width="36%">Company Name:</td>
<td width="3%"> </td>
<td width="61%">
<input type="text" id="Form_Company" name="Form_Company" />
</td>
</tr>
<tr>
<td>*E-Mail:</td>
<td> </td>
<td>
<input type="text" id="Form_Email" name="Form_Email" />
</td>
</tr>
<tr>
<td>*Address:</td>
<td> </td>
<td>
<input type="text" id="Form_Address" name="Form_Address" />
</td>
</tr>
<tr>
<td>*City:</td>
<td> </td>
<td>
<input type="text" id="Form_City" name="Form_City" />
</td>
</tr>
<tr>
<td>*State:</td>
<td> </td>
<td>
<select name="Form_State">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
</select>
</td>
</tr>
<tr>
<td>*Zip:</td>
<td> </td>
<td>
<input type="text" id="Form_Zip" name="Form_Zip" />
</td>
</tr>
<tr>
<td width="36%">*Phone Number:</td>
<td width="3%"> </td>
<td width="61%">
<input type="text" id="Form_Number" name="Form_Number" />
</td>
</tr>
<tr>
<td width="36%">Comments:</td>
<td width="3%"> </td>
<td width="61%">
<textarea id="Form_Comments" name="Form_Comments" cols="25" rows="3"></textarea>
</td>
</tr>
<tr>
<td width="36%" align="center" colspan="3">
<button id="send">Request Quote</button>
</td>
</tr>
</table>
</form>
</div></div>
<!-- basic fancybox setup -->
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function(){
$j(".various").fancybox();
$j("#contact").submit(function () {
return false;
});
$j("#send").on("click", function () {
{
// if both validate we attempt to send the e-mail
// first we hide the submit btn so the user doesnt click twice
$j("#send").replaceWith("<em>Your request has been sent...</em>");
$j.ajax({
type: "POST",
url: "AJAX_Quote2.php",
data: $j("#contact").serialize(),
success: setTimeout(function () { parent.$j.fancybox.close(); }, 2000)
});
}
});
});
</script>
AJAX_Quote2.php
<?php
include_once('class/class_email.php');
$connect = mysqli_connect("localhost","admin","pass","database");
$FName = $_POST['Form_FName'];
$LName = $_POST['Form_LName'];
$Email = $_POST['Form_Email'];
$Company = $_POST['Form_Company'];
$Number = $_POST['Form_Number'];
$Address = $_POST['Form_Address'];
$City = $_POST['Form_City'];
$State = $_POST['Form_State'];
$Zip = $_POST['Form_Zip'];
$Comments = $_POST['Form_Comments'];
$EID = $_POST['Form_ID'];
$SQL_GetEquipment = "SELECT * FROM `new_equip` WHERE `id`='$EID' LIMIT 1;";
$result = mysqli_query($connect,$SQL_GetEquipment);
$row = mysqli_fetch_assoc($result);
$EmailBody = "$FName $LName has requested a quote from NAPE on Item $EID\n
Information on quote request: \n
Name: $FName $LName \n
Address: $City \n
$State, $Zip\n
Email: $Email \n
Company: $Company \n
Number: $Number \n
Comments: $Comments \n
\n
$e = new email();
//First value is the URL of your server, the second the port number
$e->set_server( 'mail.domain.com', 26);
//First value is your username, then your password
$e->set_auth('noreply@domain.com', '112233');
//Set the "From" setting for your e-mail. The Name will be base64 encoded
$e->set_sender( 'Quote Requested', 'noreply@domain.com' );
$send_to = array('email@gmail.com');
$subject = 'Quote Request from NAPE';
$body = "$EmailBody";
if( $e->mail($send_to, $subject, $body, $headers) == true )
{
//message was received by the smtp server
//['last'] tends to contain the queue id so I like to save that string in the database
echo 'last: '.htmlspecialchars($e->srv_ret['last']).'';
}else{
//something went wrong
echo 'all: '.nl2br(htmlspecialchars($e->srv_ret['all'])).'';
echo 'full:'.nl2br(htmlspecialchars($e->srv_ret['full'])).'';
}
mysqli_query($connect,"INSERT INTO users (`id`,`fname`,`lname`,`email`,`company`,`address`,`city`,`state`,`zip`,`telephone`)
VALUES ('$id','$FName','$LName','$Email','$Company','$Address','$City','$State','$Zip','$Number')");
?>
asked 2 mins ago
AJAX Form is sending blank data to email and databse
Aucun commentaire:
Enregistrer un commentaire