My form won't submit... nothing happens when clicking the submit button. Any ideas? N.B. I am knackered, I've been up 26 hours :/

Thanks in advance for any suggestions!

        <form action="contact_me.php" method="post" class="contact-form" id="contactForm">
          <div class="controls controls-row">
            <div class="control-group span6">
              <input class="span12" name="name" placeholder="your name" type="text" />
            </div>
            <div class="control-group span6">
              <input class="span12" name="email" placeholder="your email" type="email" />
            </div>
          </div>
          <div class="controls controls-row">
            <div class="control-group span12">
              <input class="span12" name="subject" placeholder="subject" type="text" />
            </div>
          </div>
          <div class="controls controls-row">
            <div class="control-group span12">
              <textarea class="span12" name="message" placeholder="please type your message in here... " rows="5"></textarea>
            </div>
          </div>
          <div class="controls controls-row">
            <div class="control-group span12">
              <button class="btn btn-primary" name="submitButton" type="submit">
                Send Message
              </button>
            </div>
          </div>
        </form>

Dani AI

Generated

Quick diagnostic summary: the form markup in the first post looks fine, so a submit button that "does nothing" is usually caused by one of a few external factors — JavaScript errors or plugin/load-order problems, the page being opened without a PHP-capable server (file://), client-side validation or CSS/layout blocking the click, or an event handler that calls preventDefault. As and noted, swapping the control for a plain submit is a good quick test; since later mentioned the jQuery Form file was omitted, JavaScript load order and console errors deserve priority.

A compact checklist (work through in order):

  • Check the browser devtools Console for errors (missing jQuery, plugin errors, uncaught exceptions).
  • Watch the Network panel to see whether a POST is actually sent when the control is clicked.
  • Disable JavaScript temporarily to confirm native submission behavior; if the page is opened over file://, contact_me.php will not run.
  • Verify jQuery core is included before any jQuery plugins (plugin files loaded before core cause immediate script errors).
  • Search site scripts for handlers that call preventDefault on submit or intercept clicks.
  • Inspect the DOM/layout for overlays or pointer-events that could block clicks.
  • Confirm there is only one form tag surrounding the controls and no duplicate IDs on the page.

A small, non-invasive console check to observe submit firing (paste into the Console) will show whether the form’s submit event is reached:

document.getElementById('contactForm').addEventListener('submit', function(e){
  console.log('submit event fired', e && e.type);
});

If that never logs, the click isn’t reaching the form (layout/JS interference). If it logs but no request appears, a script is preventing the default or intercepting the submit for AJAX — fix the plugin/load-order or remove the faulty handler. Final gotchas: avoid naming controls submit (it shadows the form method), and prefer unobtrusive JS over inline onclick hacks so the real problem can be fixed rather than masked.

Recommended Answers

All 5 Replies

nothing happens when clicking the submit button.

could you explain me breifly somemore what the requirement is?

could you explain me breifly somemore what the requirement is?

The form should post it's data to contact_me.php, currently it's not even responding. It's acting as a button that's not even in form tags.

Not sure that a button submits without Javascript. You can try

<input type="submit">
commented: Perfect! +2

Instead of line 22-24 use the line below:-

<input class="btn btn-primary" name="submitButton" type="submit" value ="Send Message">

or you can write a javascript onClick event of button

<button class="btn btn-primary" name="submitButton" type="submit" onclick="form.submit">
                Send Message
 </button>

Thanks pritaeas! I let out my JS file ^^

<script src="javascripts/jquery.form.js" type="text/javascript"></script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.