The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 2 of 2

Thread: PHP contact form with JavaScript submit...

  1. #1

    PHP contact form with JavaScript submit...

    I can get the form to recognize the PHP file, but I keep getting the error message when using the JavaScript submit link. If it's just a regular input submit button everything works. Am I missing some JavaScript or PHP code? Any help would be appreciated. Thanks!

    <form action="sendform.php" id="form1" name="form1" method="post">
              <label>Enter Your Name:
                <input id="name" name="name" type="text">
              <label>Enter Your Email:
                <input id="email" name="email" type="email">
              <label id="message" name="message" class="txt">Enter Your Message:
              <span class="btns">
                  <a href="javascript:document.getElementById('form1').reset()" class="mrk">Reset</a>
                <a href="javascript:document.getElementById('form1').submit()" class="mrk">Submit</a>
    if( isset( $_POST['submit'] ) || isset( $_POST['submit_x'] ) ) {
        $to = ""; 
        $subject = "Contact Form";
      $name = $_POST['name'] ;
      $email = $_POST['email'] ;
      $message = $_POST['message'] ;
        $body = "
      Name: $name\n
      Email: $email\n
      Message: $message\n
        echo "Your information has been submitted. An associate will contact you shortly.";
        mail($to, $subject, $body);
    } else {
        echo "We're sorry but your form could not be sent at this time.";

  2. #2
    Registered User
    You can try this:

    HTML Code:
    <a href="javascript:void(0)" OnClick="this.form.reset()" class="mrk">Reset</a>
    <a href="javascript:void(0)" OnClick="this.form.submit()" class="mrk">Submit</a>

    HTML Code:
    <a href="javascript:this.form.reset()" class="mrk">Reset</a>
    <a href="javascript:this.form.submit()" class="mrk">Submit</a>
    Pretty sure the OnClick-event is not IE6-safe but you can try it out.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012