Results 1 to 10 of 10

Thread: "Submit" button not working

  1. #1

    Default "Submit" button not working

    Hi,

    I'm a complete newbie on making a website, but after 2 weeks of HTML editing I managed to get a fairly easy website to het up and running.

    I have included in my website a page "Contact Us", with a form like this:

    <form id="Form1" method="post" action="http://www.asia-instruments.com/cgi-bin/query.pl" style="position:absolute; left:0px; top:60px; width:470px; height:415px; font-size: 18px">

    And "input" boxes like this:

    <td height="30" width="100" valign="top">
    <span class="text">
    <span style="font-size:14px; line-height:17px; color: #FFF;">
    Name:(*)
    </span>
    </span>
    </td>
    <td width="390" height="30" align="right" valign="top">
    <input name="name" type="text" id="name" size="60" />
    </td>

    At the bottom of my "Form" I did put 2 buttons, a "Reset" button and a "Submit" button. The "Submit" button has following code:

    <div id="but2" style="position:absolute; left:425px; top:350px;">
    <input type="submit" name="sbmt" id="sbmt" value="Submit" onClick="chkForm1"/>
    </div>

    The file "query.pl" exists in the directory "http://www.asia-instruments.com/cgi-bin/".

    But when I push the "Submit" button, I get only an error message like this:

    "A misconfiguration on the server caused a hiccup.
    Check the server logs, fix the problem, then try again."

    The only thing I would like this "Form" to do, is to send all the information which was input to be send to my email address.

    Can anybody help me with this problem?


    TIA

  2. #2
    Join Date
    Feb 2006
    Posts
    627

    Default

    Well the usual problem is forgetting to chmod the perl script so it is executable BUT from your code snipet I can't tell if your just missing the end form tag or if your javascript is creating a problem :confused:

  3. #3
    Join Date
    Aug 2006
    Location
    Suburb of Detroit, Michigan
    Posts
    47

    Default

    If all you are looking to do is get the form input emailed to you, you don't need to use a script and can just use sendmail.

    Here is the form element:
    <form action="http://www.bluehost.com/bluemail" enctype="multipart/form-data" method="POST">


    Make your submit button something like this:
    <input type="hidden" name="sendtoemail" value=youremailaddress@yourdomain.com>
    <input type="submit" value="Submit">

    If you are concerned with bots spamming the email address, there are all sorts of ways to hide the address including a little javascript.
    blessings,
    Tony <><

    Have you made a difference for someone today?

  4. #4
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    4,944

    Default

    Quote Originally Posted by pmbinky View Post
    If you are concerned with bots spamming the email address, there are all sorts of ways to hide the address including a little javascript.
    A lot of spambots are now clever enough to find email addresses in the web page however you try to hide them. The only way guaranteed to work is to add the email address on the server after the form is submitted.

  5. #5

    Default

    Quote Originally Posted by pmbinky View Post
    If all you are looking to do is get the form input emailed to you, you don't need to use a script and can just use sendmail.

    Here is the form element:
    <form action="http://www.bluehost.com/bluemail" enctype="multipart/form-data" method="POST">

    Make your submit button something like this:
    <input type="hidden" name="sendtoemail" value=youremailaddress@yourdomain.com>
    <input type="submit" value="Submit">
    This is the way I programmed the page from the beginning, and which is working.

    But I added some Javascript to check that some "Input" fields contains valid data before accepting the mail and that version gives the error mentioned in my OP.

    The code in the file (contact.html) looks like this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    ..........

    <body>
    <script language=JavaScript>
    <!--
    function checkForm1()
    {
    if (document.forms.Form1.elements['name'].value.length == 0) {
    alert('Please enter a value for the "name" field');
    return false;
    }
    if (document.forms.Form1.elements['email'].value.length == 0) {
    alert('Please enter a value for the "Your email address" field');
    return false;
    }
    if (document.forms.Form1.elements['comments'].value.length == 0) {
    alert('Please enter a value for the "comments" field');
    return false;
    }
    return true;
    }
    //-->
    </script>

    <form action="http://www.domain.com/domainmail"
    enctype="multipart/form-data" method="POST">
    <table border="0" cellspacing="0" cellpadding="0" width="500" height="300">
    <td height="30" width="390" valign="top" align="right"><input name="name"
    type="text" id="name" size="60"></td>
    <td height="30" width="390" valign="top" align="right"><input
    name="mailfrom" type="text" id="email" size="60"></td>
    <td height="30" width="390" valign="top" align="right"><textarea
    style="margin-top:0;margin-bottom:0;width:380px;height:100px;"
    name="comment" type="text" id="comment"></textarea></td>
    </table>

    <div id="but2" style="position:absolute; left:400px; top:350px;"><input
    type="submit" value="Send Email" onClick="chkForm1"><input type="hidden"
    name="sendtoemail" value="name@domain.com">
    </div>
    </form></div>
    </body>
    </html>

  6. #6

    Default

    Quote Originally Posted by felgall View Post
    A lot of spambots are now clever enough to find email addresses in the web page however you try to hide them. The only way guaranteed to work is to add the email address on the server after the form is submitted.
    Can you give me a working example of how to add the email address AFTER the form is submitted?

    I had no intention of hiding my email address at the beginning, but if it is so easy, I would be glad to show the spamboots and the spammers my middle finger.

    TIA

  7. #7
    Join Date
    Aug 2006
    Location
    Suburb of Detroit, Michigan
    Posts
    47

    Default

    Hey encoder,
    For that javascript, take it out of the <body> tag and move it up into the <head> since it has nothing to do with the display of page and add a passed argument to it so it looks like:
    function checkForm1(theForm)

    Also, in your <form> tag add an 'onSubmit' :
    <form action=http://www.domain.com/domainmail enctype="multipart/form-data" method="POST" onSubmit="return checkForm1(this);">

    remove the onClick="chkForm1" from your submit
    Last edited by pmbinky; 01-19-2009 at 06:16 AM.
    blessings,
    Tony <><

    Have you made a difference for someone today?

  8. #8

    Default

    If all you have going on with the form are those 3 fields, (name, E-Mail, and Comments) I will give you (free) a PHP script that will do authentication on your form and then send it to your Inbox. If you want to go that way, send me a message through the forum or e-mail me at design at premierewebdesign.net.

  9. #9

    Default

    Actually, I already have the script on my website on my free downloads page. If you want it, please follow this link and you will see the Contact Form listed. http://www.premierewebdesign.net/downloads.html

  10. #10
    Join Date
    Feb 2009
    Posts
    7

    Default

    You can test this as below,
    <form action="mycgi.pl" onsubmit="return false;">
    <input type="submit" name="submit" value='Submit'
    onClick="window.location.href='http://myserver.com'">
    </form>

    The ' onsubmit="return false;"' will prevent the form submission so
    that the onclick javascript will be executed.

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
  •