January 24, 201412 yr I am not receiving emails from this form. Can anyone suggest why? HTML <!DOCTYPE html> <!--[if lt IE 7 ]><html class="ie ie6" lang="en-US"> <![endif]--> <!--[if IE 7 ]><html class="ie ie7" lang="en-US"> <![endif]--> <!--[if IE 8 ]><html class="ie ie8" lang="en-US"> <![endif]--> <!--[if (gte IE 9)|!(IE)]><!--> <html lang="en-US"><!--<![endif]--> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!-- Basic Page Needs ================================================== --> <meta charset="UTF-8"> <title>Marc Zaidman Professional Services</title> <meta name="keywords" content=""> <meta name="description" content=""> <meta name="author" content=""> <!-- Mobile Specific Metas ================================================== --> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <!-- Favicons ================================================== --> <!--<link rel='shortcut icon' href='./images/favicon.ico'> <link rel='apple-touch-icon' href='./images/apple-touch-icon.png'> <link rel='apple-touch-icon' sizes='72x72' href='./images/apple-touch-icon-72x72.png'> <link rel='apple-touch-icon' sizes='114x114' href='./images/apple-touch-icon-114x114.png'>--> <!-- CSS ================================================== --> <link rel="stylesheet" id="o-responsive-css" href="./css/o-responsive.css" type="text/css" media="all"> <link rel="stylesheet" id="themestyle-css" href="./style.css" type="text/css" media="all"> <link rel="stylesheet" id="prettyPhoto-css" href="./css/prettyPhoto.css" media="screen"> <link rel="stylesheet" id="photoswipe-css" href="./css/photoswipe.css" type="text/css" media="all"> <link rel="stylesheet" id="glyphicons-css" href="./css/glyphicons.css" type="text/css" media="all"> <!-- Google Fonts ================================================== --> <link href='http://fonts.googleapis.com/css?family=Lato:300,400,900,300italic,400italic,900italic' rel='stylesheet' type='text/css'> </head> <body class="fullwidth boxed " data-device="" data-maxcols=""> <div id="top"></div> <div id="header"> <div class="container wrap text-center"> <span class="marc-zaidman-mobile">MZPS</span> <span class="marc-zaidman-desktop">Marc Zaidman</span> <span class="professional-services-desktop"> Professional Services</span> </div> <a href="#sidr" id="menutrigger" class="pull-right btn icon transparent"><span class="glyphicons justify"><i></i></span></a><span class="clear"></span> </div><!-- /#header --> <div id="sidr" class="hidden"> <h3>Navigation</h3><a href="#" class="navclose"><span class="glyphicons remove_2"><i></i></span></a> <ul> <li><a href="#home" ><span class="glyphicons home"><i></i></span>Home</a></li> <li><a href="#about" ><span class="glyphicons user"><i></i></span>About Me</a></li> <li><a href="#social"><span class="glyphicons heart"><i></i></span>My Goal</a></li> <li><a href="#services2"><span class="glyphicons dislikes"><i></i></span>Services</a></li> <li><a href="#contact"><span class="glyphicons envelope"><i></i></span>Contact me</a></li> </ul> </div> <div id="home" class="sugar-container"> <div class="container wrap"> <div class="row"> <div class="col dimfull text-center" id="animation"> <div id="ccimage" class="img-circle"><img src="./images/me.jpg" alt=""></div> <h1 id="ccname" class=" ">Marc Zaidman</h1> <h2 id="ccfunction" class=" ">Professional Services</h2> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.container --> </div><!-- /#home --> <div id="about" class="cream-container parallax" data-speed="4" data-offsetY="-150"> <div class="icon-container"><div><span class="glyphicons user"><i></i></span></div></div> <div class="container wrap"> <div class="row"> <div class="col dimfull text-center"> <h2>About MZPS</h2> <div class="position2 row"> <div class="col dim1third text-right padright"> <h3>Introduction</h3> </div> <div class="col dim2thirds text-left padleft post-content"> <h4>Welcome</h4> <p>I would like to introduce you to my recently established consultancy which I believe may be of interest to you.</p> <p>Marc Zaidman Professional Services (MZPS) is a privately-owned personal finance administration consultancy offering guidance, support and administrative services for non- regulated financial matters to individuals within the Dorset area. There is often a bridge needed between banks, financial institutions and solicitors which I can provide for you or a client's relative on your behalf.</p> </div> </div> <div class="position2 row"> <div class="col dim1third text-right padright"> <h3>Experience</h3> </div> <div class="col dim2thirds text-left padleft post-content"> <h4>Corporate and Personal Banking</h4> <p>Twenty-five years experience of corporate and personal banking with HSBC and Lloyd's banks has given me a unique insight into the issues faced by individuals who struggle with basic non-regulated financial management issues.</p> <p>I am particularly experienced in communicating and dealing with elderly clients. Declining health and infirmity often means that older clients require professional and experienced support in administering their personal finances from a reliable and trustworthy source. Such assistance, can in some cases, help clients retain an independent life at home with peace of mind.</p> </div> </div> <div class="position2 row"> <div class="col dim1third text-right padright"> <h3>Policy</h3> </div> <div class="col dim2thirds text-left padleft post-content"> <h4>Professional and Public Insurance</h4> <p>Clients can be assured that MZPS is fully covered by professional liability insurance and public liability insurance.</p> <p>All client work is covered by a legal terms of business between the client, their relative and MZPS. MZPS does not accept remuneration from a client's estate upon their demise.</p> </div> </div> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.container --> </div><!-- /#education --> <div id="social" class="coffee-container parallax" data-speed="24" data-offsetY="-150"> <div class="icon-container"><div><span class="glyphicons heart"><i></i></span></div></div> <div class="container wrap"> <div class="row"> <div class="col dimfull text-center"> <h2>My Goal</h2> <p class="intro">MZPS aims to provide a service which supports individuals in making decisions about their personal financial management and to assist them in the administrative tasks that those decisions entail.</p> <div class="more"> <a href="#" class="btn transparent"><span class="glyphicons facebook"><i></i></span>Facebook</a> <a href="#" class="btn transparent"><span class="glyphicons twitter"><i></i></span>Twitter</a> <a href="#" class="btn transparent"><span class="glyphicons google_plus"><i></i></span>Google Plus</a> </div> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.container --> </div><!-- /#social --> <div id="services2" class="cream-container parallax" data-speed="25" data-offsetY="-150"> <div class="icon-container"><div><span class="glyphicons dislikes"><i></i></span></div></div> <div class="container wrap"> <div class="row"> <div class="col dimfull text-center"> <h2>Services</h2> <p class="intro">MZPS offers individuals and their families support in three key areas:</p> <ul data-target="o-container2" class="btn-nav o-filters centered padbottom"> <li class="active"><a data-filter="#service-1" href="#">Money Management</a></li> <li><a data-filter="#service-2" href="#">Support During Bereavement </a></li> <li><a data-filter="#service-3" href="#">Assistance</a></li> </ul> <div class="row o-items-container format-mosaic o-index services2" data-cols="1" id="o-container2"> <div class="row o-item" data-cols="1" id="service-1"> <div class="col dim1quarter padright"> <img src="./images/iconserv1.png" alt=""> </div> <div class="col dim3quarters text-left padleft"> <h3>Day to day professional money management</h3> <p>For example, this could take the form of accompanied visits to the bank, or simply dealing with everyday money administrative issues that can cause concern and confusion. The world today is often complex and bewildering for older people so help with everyday issues such as dealing with the post or fixing price rates for utilities can be very useful and welcome.</p> <br> <p>Note: The fees charged by MZPS are calculated on an hourly rate fixed cost packages may be negotiated.</p> </div> </div><!-- /.col .o-item --> <div class="row o-item hidden" data-cols="1" id="service-2"> <div class="col dim1quarter padright"> <img src="./images/iconserv2.png" alt=""> </div> <div class="col dim3quarters text-left padleft"> <h3>Support during bereavement for concerned families and friends</h3> <p>Every day administration support at this delicate stage can provide reassurance. Helping to administer the estate, by liaising with lawyers, banks, insurance companies, utility companies, estate agents, etc.</p> <br> <p>Note: The fees charged by MZPS are calculated on an hourly rate fixed cost packages may be negotiated.</p> </div> </div><!-- /.col .o-item --> <div class="row o-item hidden" data-cols="1" id="service-3"> <div class="col dim1quarter padright"> <img src="./images/iconserv4.png" alt=""> </div> <div class="col dim3quarters text-left padleft"> <h3>Assistance during a move to a residential or nursing home</h3> <p>Conducting research into the choices of available residential or nursing homes based on an individual's personal requirements. Making all the arrangements for the move and all the required administration.</p> <br> <p>Note: The fees charged by MZPS are calculated on an hourly rate fixed cost packages may be negotiated.</p> </div> </div><!-- /.col .o-item --> </div><!-- /.o-items-container --> <p class="intro">My qualifications do not enable me to provide regulated financial advice under the terms of the FCA (Financial Conduct Authority). Where MZPS makes a client referral to an appropriately qualified organisation, no commission is paid to MZPS for the introduction.</p> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.container --> </div><!-- /#services2 --> <div id="contact" class="coffee-container parallax" data-speed="32" data-offsetY="-150"> <div class="icon-container"><div><span class="glyphicons envelope"><i></i></span></div></div> <div class="container wrap"> <div class="row"> <div class="col dimfull text-center"> <h2>Contact me</h2> <p class="intro">I would welcome an opportunity to discuss how MZPS can work in conjunction with your practice/firm to our mutual benefit and that of your clients. Please contact me on 07943 734010 or 01202 751297 to arrange a meeting at your convenience. I look forward to hearing from you.</p> <form id="contact-form" method="post" action="#contact-form" class="text-left" data-form-action="./email.php"> <div class="email-confirmation hidden"><span class="glyphicons ok_2"><i></i></span> Email Success</div> <div class="email-error hidden"><span class="glyphicons remove_2"><i></i></span> Email Error</div> <input type="hidden" name="emailto" value="myemail@yahoo.com"> <input type="hidden" name="websitename" value="MYSITE"> <p> <label for="form-name">Name</label> <input type="text" class="mandatory" placeholder="Your name" id="form-name" name="form-name" value=""> <span class="error-message hidden"><span class="glyphicons ban"><i></i></span> Missing Name</span> </p> <p> <label for="form-email">Email</label> <input type="text" class="mandatory" placeholder="Your email" id="form-email" name="form-email" value=""> <span class="error-message hidden"><span class="glyphicons ban"><i></i></span> Missing or invalid Email</span> </p> <p> <label for="form-subject">Subject</label> <input type="text" placeholder="Email Subject" id="form-subject" name="form-subject" value=""> </p> <p> <label for="form-message">Message</label> <textarea rows="6" class="mandatory" placeholder="Your message" id="form-message" name="form-message" ></textarea> <span class="error-message hidden"><span class="glyphicons ban"><i></i></span> Missing Mail Message</span> </p> <span class="clear"></span> <p> <button type="submit" class="btn btn-primary" name="form-submit">Submit</button> </p> </form> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.container --> </div><!-- /#contact --> <div id="copyright" class="test"> <div class="container wrap"> <div class="row"> <div class="col dimfull text-center"> <p>Site powered by ME</p> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.container --> </div><!-- /#copyright --> <a style="display: none;" href="#" id="scrolltop" title="Top"><span class="glyphicons up_arrow"><i></i></span></a> <!-- End Document ================================================== --> <script type="text/javascript" src="./js/jquery.min.js"></script> <script type='text/javascript' src='./js/jquery.easing.1.3.js'></script> <script type='text/javascript' src='./js/jquery.isotope.min.js'></script> <script type='text/javascript' src='./js/jquery.elastislide.js'></script> <script type='text/javascript' src="./js/jquery.prettyPhoto.js"></script> <script type='text/javascript' src='./js/klass.min.js'></script> <script type='text/javascript' src='./js/code.photoswipe.jquery-3.0.4.min.js'></script> <script type='text/javascript' src='./js/jquery.jtwt.min.js'></script> <script type='text/javascript' src='./js/jquery.sidr.min.js'></script> <script type='text/javascript' src='./js/responsiveslides.min.js'></script> <script type='text/javascript' src='./js/scripts.js'></script> </body> </html> PHP <?php // PHP email $emailTo = $_POST['emailto']; $websitename = $_POST['websitename']; $name = $_POST['form-name']; $subject = $_POST['form-subject']; if($subject == '') { $subject = "Message from $websitename contact form"; } $message = $_POST['form-message']; $email = $_POST['form-email']; $body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nMessage:\n $message"; $headers = 'From: '.$websitename.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; mail($emailTo, $subject, $body, $headers); $emailSent = true; ?>
January 24, 201412 yr I am not familiar with the use of both 'action' and 'data-form-action' the way that you are trying to use them; However, it is my understanding that the action='#contact_form' is invalid and that the action should always be the script name (and path) that will process the submitted form. A simple check to make sure that your php script is receiving the posted data would be to insert if ( !isset( $_POST ) ) { $mailsent = false; } else { // Then process your mail within the else including if the mail is sent // setting the $mailSent = true; // return ; } // Then as a double check set $mailSent = false; again here incase something fails! and include a php if statement to output a message if the $mailSent is false within your page that can be easily removed. One major point is with your current php file do not ever use that on a live server as it will be almost instantly abused by spammers, and any hackers will cause mayhem on the server! It needs some serious sanitizing first!
January 24, 201412 yr Author Roger that and understood. OK so I have changed my form around and everything works except one thing. My JavaScript error checking function works but email dosnt send. if I remove the id="contact-form" from the form tag then I receive the email. The JavaScript is preventing it from working, any ideas? HTML <form id="contact-form" method="post" action="email.php" class="text-left"> <div class="email-confirmation hidden"><span class="glyphicons ok_2"><i></i></span> Email Success</div> <div class="email-error hidden"><span class="glyphicons remove_2"><i></i></span> Email Error</div> <input id="this_title" class="hidden" type="text" name="this_title" value="" /> <p> <label for="form-name">Name</label> <input type="text" class="mandatory" placeholder="Your name" id="form-name" name="form-name" value=""> <span class="error-message hidden"><span class="glyphicons ban"><i></i></span> Missing Name</span> </p> <p> <label for="form-email">Email</label> <input type="text" class="mandatory" placeholder="Your email" id="form-email" name="form-email" value=""> <span class="error-message hidden"><span class="glyphicons ban"><i></i></span> Missing or invalid Email</span> </p> <p> <label for="form-subject">Subject</label> <input type="text" placeholder="Email Subject" id="form-subject" name="form-subject" value=""> </p> <p> <label for="form-message">Message</label> <textarea rows="6" class="mandatory" placeholder="Your message" id="form-message" name="form-message" ></textarea> <span class="error-message hidden"><span class="glyphicons ban"><i></i></span> Missing Mail Message</span> </p> <span class="clear"></span> <p> <button type="submit" class="btn btn-primary" name="form-submit">Submit</button> </p> </form> PHP <?php // PHP email $this_form_spam = filter_input(INPUT_POST, 'this_title'); $name = filter_input(INPUT_POST, 'form-name'); $email = filter_input(INPUT_POST, 'form-email'); $subject = filter_input(INPUT_POST, 'form-subject'); if ($subject == '') {$subject = "Message from ZAIDMAN.COM contact form";} $message = filter_input(INPUT_POST, 'form-message'); $from = 'FROM: Marc Zaidman Website Form'; $to = 'myemail@yahoo.com'; $body = "FROM: $name \nEMAIL: $email \n\nMESSAGE: $message"; $sent = mail($to, $subject, $body, $from); if ($this_form_spam != "") { // mock and laugh in the face of spam echo 'POSSIBLE SPAM EMAIL'; } ?> JS $('#contact-form').live('submit', function(event) { event.preventDefault(); var sendemail = 1; $(this).find('input.mandatory,textarea.mandatory').each(function(){ var fieldvalue = trim($(this).val()); var errorfield = $(this).next('.error-message'); if(fieldvalue == ''){ $(this).addClass('error'); errorfield.show(); sendemail = 0; }else{ if($(this).attr('name') == 'form-email'){ var email_regex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; if(!email_regex.test(fieldvalue)){ $(this).addClass('error'); errorfield.show(); sendemail = 0; } else { $(this).removeClass('error'); errorfield.hide(); } } else { $(this).removeClass('error'); errorfield.hide(); } } }); if(sendemail != 0){ var form = $(this); var name = $(this).find('[name=form-name]').val(); var email = $(this).find('[name=form-email]').val(); var message = $(this).find('[name=form-message]').val(); var emailurl = $(this).attr('data-form-action'); var confirmbox = $(this).find('.email-confirmation'); var errorbox = $(this).find('.email-error'); $.ajax({ url: emailurl, data: $(form).serialize(), type: 'POST' }) .done(function() { confirmbox.fadeIn(500).delay(2500).fadeOut(500); $('#contact-form input, #contact-form textarea').each(function(){ $(this).val(''); }); }) .fail(function() { errorbox.fadeIn(500).delay(5000).fadeOut(500); }); } }); Edited January 24, 201412 yr by dpuk44
January 24, 201412 yr I sorry but java, and especially referencing with java is a subject I know nothing about as I have never used java. Not that it should make any difference, but I always place the id and name at the end of the opening form tag and method at the start. Might be worth a try. The validation can also be performed equally well directly in the php script though, and if anything does not validate you can simply pass all the collected data back to the form with error messages of your choosing.
Create an account or sign in to comment