Jump to content

html/js/php contact form


90_mati

Recommended Posts

Hello

 

I have problem with my contact form :/ I dowload some script in JS and HTML. I chang somevaluean all it's ok. ActuallyI have only good looking form but nothing else. I am traying erite something in php, but it's not work. I started with some easy examples...

 

Details behind

<? extract($_POST);mail("myemail@gmail.com", "teaamat", $textarea);?> 
var form = $('#contact'),    submit = form.find('[name="submit"]');form.on('submit', function(e) {  e.preventDefault();    // avoid spamming buttons  if (submit.attr('value') !== 'Send')    return;    var valid = true;  form.find('input, textarea').removeClass('invalid').each(function() {    if (!this.value) {      $(this).addClass('invalid');      valid = false;    }  });    if (!valid) {    form.animate({left: '-3em'},  50)        .animate({left:  '3em'}, 100)        .animate({left:    '0'},  50);  } else {    submit.attr('value', 'Sending...')          .css({boxShadow: '0 0 200em 200em rgba(225, 225, 225, 0.6)',                backgroundColor: '#ccc'});    // simulate AJAX response    setTimeout(function() {      // step 1: slide labels and inputs      // when AJAX responds with success      // no animation for AJAX failure yet      form.find('label')          .animate({left: '100%'}, 500)          .animate({opacity: '0'}, 500);    }, 1000);    setTimeout(function() {      // step 2: show thank you message after step 1      submit.attr('value', 'Thank you :)')            .css({boxShadow: 'none'});    }, 2000);    setTimeout(function() {      // step 3: reset      form.find('input, textarea').val('');      form.find('label')          .css({left: '0'})          .animate({opacity: '1'}, 500);      submit.attr('value', 'Send')            .css({backgroundColor: ''});    }, 4000);  }});
   <section id="contact-form">                 <h2>Contact</h2>                                                      <form method="POST" action="contactform.php">                                               <label><span>Name</span><input name="name" type="text" placeholder="Name"/></label>                  <label><span>Email</span><input name="email" type="text" placeholder="Email"/></label>                  <label><span>Message</span><textarea name="message" placeholder="Message"></textarea></label>                  <input name="submit" type="submit" value="Send"/>                 </form>                 <aside>                  <div id="mapa"></div>                 </aside>               </section>
Link to comment
Share on other sites

Check your developer console, you should be getting Javascript errors. It doesn't look like you're using the correct selector for the form. It also doesn't look like that Javascript code actually submits the form data to the server.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...