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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Please Help me with SUBMIT Button

    I've been trying to solve this for almost 4hrs now, I am still in no where from solving this issue.

    This is the complete code of the page. When I click on submit button, nothing will showed up and nothing will be sent to "contact.php". please help me. Thanks all
    <"
    <div id="contentArea">
    <div id="contentArea11">
    <div class="contentArea12">
    <h2>Contact Kirk Waller</h2>
    <br /><strong>Phone:</strong> 510-290-0253 <br /><br /><form id="form_email" action="contact.php" enctype="application/x-www-form-urlencoded" method="post">
    <script type="text/javascript">// <![CDATA[
    function FormValidate(RegForm)
    {
    // ----------- NAME -----------------------------------
    if (document.form_email.name.value == "")
    {
    alert("Please enter Full Name");
    document.form_email.name.focus();
    return (false);
    }

    if (document.form_email.email.value == "")
    {
    alert("Please enter Email");
    document.form_email.email.focus();
    return (false);
    }


    // Check Email
    var checkEmail = "@.";
    var checkStr = document.form_email.email.value;
    var EmailValid = false;
    var EmailAt = false;
    var EmailPeriod = false;
    for (i = 0; i < checkStr.length; i++)
    {
    ch = checkStr.charAt(i);
    for (j = 0; j < checkEmail.length; j++)
    {
    if (ch == checkEmail.charAt(j) && ch == "@")
    EmailAt = true;
    if (ch == checkEmail.charAt(j) && ch == ".")
    EmailPeriod = true;
    if (EmailAt && EmailPeriod)
    break;
    if (j == checkEmail.length)
    break;
    }
    // if both the @ and . were in the string
    if (EmailAt && EmailPeriod)
    {
    EmailValid = true
    break;
    }
    }
    if (!EmailValid)
    {
    alert("The \"E-mail\" field is invalid, please try again. It must contain an \"@\" and a \".\".");
    document.form_email.email.focus();
    return (false);
    }
    // ----------- NAME -----------------------------------
    if (document.form_email.phone.value == "")
    {
    alert("Please enter Phone");
    document.form_email.phone.focus();
    return (false);
    }
    // ----------- EMAIL -----------------------------------


    // ----------- Subject -----------------------------------
    if (document.form_email.subject.value == "")
    {
    alert("Please enter Subject");
    document.form_email.subject.focus();
    return (false);
    }
    // ----------- Enquiry -----------------------------------
    if (document.form_email.comments.value == "")
    {
    alert("Please enter comments");
    document.form_email.comments.focus();
    return (false);
    }

    //document.form_email.submit();
    }
    // ]]></script>
    <table style="width: 829px; height: 411px;" border="0" cellspacing="4" cellpadding="4">
    <tbody>
    <tr align="center">
    <td class="text4" style="width: 100px;" align="left"><strong>Name:</strong></td>
    <td style="width: 250px;" align="left"><input class="field" name="name" size="30" type="text" /> *</td>
    <td rowspan="7" valign="top">
    <p><img src="images/imageq.jpg" alt="" width="388" height="194" /></p>
    <pre id="line130"><br /></pre>
    Ready to submit? &gt;&gt; <input type="submit" value="Submit" /></td>
    </tr>
    <tr>
    <td class="text4"><strong>Phone:</strong></td>
    <td><input id="phone" class="field" name="phone" size="30" type="text" /> *</td>
    </tr>
    <tr>
    <td class="text4"><strong>Email:</strong></td>
    <td><input class="field" name="email" size="30" type="text" /> *</td>
    </tr>
    <tr>
    <td class="text4"><strong>Date:</strong></td>
    <td><input id="date" class="field" name="date" size="30" type="text" /> *</td>
    </tr>
    <tr>
    <td class="text4"><strong>Referred By:</strong></td>
    <td><input id="reffer" class="field" name="reffer" size="30" type="text" /> *</td>
    </tr>
    <tr>
    <td class="text4"><strong>Subjet:</strong></td>
    <td><input id="subject" class="field" name="subject" size="30" type="text" /> *</td>
    </tr>
    <tr>
    <td class="text4"><strong>Feedback:</strong></td>
    <td><textarea class="mceNoEditor" cols="10" rows="5" name="comments"></textarea></td>
    </tr>
    </tbody>
    </table>
    </form></div>
    </div>
    </div>

    ">

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Read this and modify your post:

    Please wrap PHP codes using the [PHP][/PHP] tag

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Completely ignoring javascript (since this is the php forum), hitting the submit button should (and according to this, always will) transfer you to the contact.php and have the $_POST for name. I'm trying to recall offhand if it will just have name due to the location of the submit button, or if it will always have every input. I think its just the input declared before it.
    As for you're javascript, I don't expect it to execute since its not called or hooked in anywhere.
    If this is a question about javascript though, post that it is so I can move it from the PHP forum.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #4
    Regular Coder grumpy's Avatar
    Join Date
    Oct 2006
    Location
    Visible light spectrum
    Posts
    121
    Thanks
    5
    Thanked 6 Times in 6 Posts
    You have the submit button tags in front of most of your other inputs. Move it to the bottom of the form. Usually post submits all inputs before the "submit" as far as I know.

  • #5
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Quote Originally Posted by grumpy View Post
    You have the submit button tags in front of most of your other inputs. Move it to the bottom of the form. Usually post submits all inputs before the "submit" as far as I know.
    That's completely false... the location of the submit input element has no effect on which input elements are submitted. All input elements inside the <form> and </form> tags will be submitted.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by Fumigator View Post
    That's completely false... the location of the submit input element has no effect on which input elements are submitted. All input elements inside the <form> and </form> tags will be submitted.
    Thats good to know, offhand I was also uncertain, so I presumed it was just predeclared inputs as well. I guess I probably could have tested with just html and get method since I have no PHP env here.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Tags for this Thread

    Posting Permissions

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