Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2011
    Posts
    57
    Thanks
    8
    Thanked 0 Times in 0 Posts

    not receiving email from form

    Hey all, I'm trying to email this form to myself using jQuery.ajax script but for some reason I'm not getting the emails. Here is my html for where the jquery exists on:

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    	<title>Form</title>
    	<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
    	<link rel="stylesheet" href="css/template.css" type="text/css"/>
    	<script src="js/jquery-1.6.min.js" type="text/javascript">
    	</script>
    	<script src="js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8">
    	</script>
    	<script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8">
    	</script>
    	<script src="js/formcalculations.js" type="text/javascript" charset="utf-8">
    	</script>
    	<script>
    var result = new Array();
    result[4400]= "<h3>Category One - $4,400/Year</h3><ul><li>Allergy & Immunology</li><li>Endocrinology</li><li>Pathology</li><li>Dermatology</li><li>Geriatrics</li><li>Physical Rehabilitation</li></ul>";
    result[6900]= "<h3>Category Two - $6,900/Year</h3><ul><li>Family Practice</li><li>General Practice</li><li>Internal Medicine</li><li>Onconlogy</li><li>Oral Surgrey</li><li>Radiology</li><li>Gastroenterology</li><li>Infectious Disease</li><li>Nephrology</li><li>Ophthalmology</li><li>Pediatrics</li><li>Urology</li></ul>";
    result[9000]= "<h3>Category Three - $9,000/Year</h3><ul><li>Anesthesiology</li><li>Cosmetic Surgrey</li><li>General Surgrey</li><li>Neurology</li><li>Otolaryngology</li><li>Plastic Surgery</li><li>Vascular Surgery</li><li>Cardiology</li><li>Emergency Medicine</li><li>Gynecology</li><li>Orthopedic Surgery</li><li>Pain Management</li><li>Pulmonary Surgery</li></ul>";
    result[9900]= "<h3>Category Four - $9,900/Year</h3><ul><li>Neurological Surgery</li><li>Obstetrics</li></ul>";
    
    
    
    
    		function sendForm() {
    			var user = jQuery("#username").val();
    			var address = jQuery("#address").val();
    			var phone = jQuery("#phone").val();
    			var practice= jQuery("#practice").val();
    			var society= jQuery("#society").val();
    			var phone = jQuery("#phone").val();
    			var bare = jQuery("#baredefense");
    			var insured = jQuery("#insureddefense");
    var interested = "";
    if( bare.attr("checked") == "checked" &&  insured.attr("checked") == "checked" ) {
    	interested = "Bare Defense And Insured Defense";
    }else if(bare.attr("checked") == "checked") {
    	interested = "Bare Defense";
    }else if(insured .attr("checked") == "checked") {
    	interested = "Insured Defense";
    }else {	interested = "";}
    
    var titleSociety = jQuery('#society option:selected').text();
    			var fdata = "username="+name+"&address="+address+"&phone="+phone+"&practice="+practice+"&society="+titleSociety+"&interested="+interested;
    			var content = "Practice Field: "+practice+"<br />Medical Society: "+titleSociety+"<br />Interested in: "+interested;
    var res = calculateTotal();
    			jQuery("#CalculationResult").html(content+"<br /><br />"+res);
    			jQuery.ajax({
    				url: "js/ajax.php",
    				data: fdata,
    				method: "GET",
    				success: function(r) {
    //					setTimeout("clearForm()", 2000);
    				}
    			});
    			return false;
    		}
    		jQuery(document).ready(function(){
    			// binds form submission and fields to the validation engine
    			//jQuery("#quoteform").validationEngine();
    			jQuery("#quoteform").validationEngine('attach', {
                  onValidationComplete: function(form, status){
    				if(status == true) {
    					sendForm(); 
    				}
    				return false;
                  }  
                });
    		});
    	function clearForm(){
    		//jQuery("#quoteform").hide();
    		document.getElementById('quoteform').reset();
    		jQuery("#quoteform").validationEngine('hideAll');
    		return false;
    	}
    
    	</script>
    </head>
    <body>
    
    	<form id="quoteform" class="formular" method="post">
    			<fieldset>
    				<legend>
    					How Much Will My Pre-Paid Legal Defense Cost?
    				</legend>
    				<div class="FormContainer">
    				
    					<label>
    						<span>Name *: </span>
    						<input value="" class="validate[required] text-input" type="text" name="username" id="username" />
    					</label>
    					<label>
    						<span>Address *: </span>
    						<input value="" class="validate[required] text-input" type="text" name="address" id="address" />
    					</label>
    					<label>
    						<span>Phone number *: </span>
    						<input value="" class="validate[required,custom[phone]] text-input" type="text" name="phone" id="phone" />
    					</label>
    					<label>
    						<span>Choose Your Practice Field
    *:</span>
    						<select name="practice" id="practice" class="validate[required]">
    <option value="">--Select Field--</option>
    <option value="Allergy and Immunology">Allergy and Immunology</option>
    <option value="Endocrinology">Endocrinology</option>
    <option value="Pathology">Pathology</option>
    <option value="Dermatology">Dermatology</option>
    <option value="Geriatrics">Geriatrics</option>
    <option value="Physical Rehabilitation">Physical Rehabilitation</option>
    <option value="Family Practice">Family Practice</option>
    <option value="General Practice">General Practice</option>
    <option value="Internal Medicine">Internal Medicine</option>
    <option value="Oncology">Oncology</option>
    <option value="Oral Surgery">Oral Surgery</option>
    <option value="Radiology">Radiology</option>
    <option value="Gastroenterology">Gastroenterology</option>
    <option value="Infectious Disease">Infectious Disease</option>
    <option value="Nephrology">Nephrology</option>
    <option value="Ophthalmology">Ophthalmology</option>
    <option value="Pediatrics">Pediatrics</option>
    <option value="Urology">Urology</option>
    <option value="Anesthesiology">Anesthesiology</option>
    <option value="Cosmetic Surgery">Cosmetic Surgery</option>
    <option value="General Surgery">General Surgery</option>
    <option value="Neurology">Neurology</option>
    <option value="Otolaryngology">Otolaryngology</option>
    <option value="Plastic Surgery">Plastic Surgery</option>
    <option value="Vascular Surgery">Vascular Surgery</option>
    <option value="Cardiology">Cardiology</option>
    <option value="Emergency Medicine">Emergency Medicine</option>
    <option value="Gynecology">Gynecology</option>
    <option value="Orthopedic Surgery">Orthopedic Surgery</option>
    <option value="90Pain Management00">Pain Management</option>
    <option value="Pulmonary Surgery">Pulmonary Surgery</option>
    <option value="Neurological Surgery">Neurological Surgery</option>
    <option value="Obstetrics">Obstetrics</option>
    
    
    							</option>
    						</select>
    					</label>
    					<label>
    						<span>Are You Affiliated With Any of the Following Medical Societies *:</span>
    						<select name="society" id="society" class="validate[required]">
    <option value="">--Select Society--</option>
    <option value="0">No, I am not</option>
    
    							<option value="BCMA">Broward County Medical Association</option>
    							<option value="DCMA">Dade County Medical Association</option>
    							<option value="FOGS">Florida Obstetrics & Gynecology Society</option>
    							<option value="FNS">Florida Neurological Society</option><option value="PBCMS">Palm Beach County Medical Society</option><option value="FSPS">Florida Society of Plastic Surgeons</option>
    						</select>
    					</label>
    					<label>
    						<span>What Type of Defense Are You Interested In?
    *:</span><br />
    Bare Defense&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    						<input type="checkbox" value="5" id="baredefense" name="baredefense" class="d"><br />Insured Defense						<input type="checkbox" value="5" id="insureddefense" name="insureddefense" class="">
    					</label>
    					<input class="submit" onclick="clearForm();" type="reset" value="Reset!"/>&nbsp;&nbsp;&nbsp;
    					<input class="submit" type="submit" value="Submit!"/><hr/>
    				</div>
    				<div class="CalculationContainer">
    					<div id="CalculationResult">
    						Please select....
    					</div>
    				</div>
    			</fieldset>
    		
    		
    		<!--
    		<fieldset>
    			<legend>
    				Equals
    			</legend>
    			<label>
    				<span>Password : </span>
    				<input value="karnius" class="validate[required] text-input" type="password" name="password" id="password" />
    			</label>
    			<label>
    				<span>Confirm password : </span>
    				<input value="kaniusBAD" class="validate[required,equals[password]] text-input" type="password" name="password2" id="password2" />
    			</label>
    		</fieldset>
    		-->
    		
    	</form>
    </body>
    </html>

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    I don't know what you want done with
    for some reason I'm not getting the emails
    What have you tested so far?
    What are you getting?
    Did you get some kind of error?
    Have you verified that the error is in your jQuery and not in ajax.php?
    Have you ensured that the code reaches the ajax call at all?
    Code:
    alert('Sending Ajax, wish me luck!');
    jQuery.ajax({
    				url: "js/ajax.php",
    				data: fdata,
    				method: "GET",
    				success: function(r) {
    //					setTimeout("clearForm()", 2000);
    				}
    			});
    Allwisend bin ich nicht, doch viel ist mir bewursst
    -Goethe

  • #3
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    If you're not getting the emails, the problem is most likely in the server side script your ajax request is sending data to, assuming the ajax request is executed in the first place.

    One thing for sure, php mail() needs SMTP to be enabled on the server the email is being sent from.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •