SitePoint Sponsor

User Tag List

Results 1 to 14 of 14

Thread: form problems

  1. #1
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I am trying to make a form to email the input to a certain email. We have the server here in our shop. How can I find out, or where can I look to get info on making the appropriate file to go in the <form action="??????" method="post"> I am lost. Thank you for your help

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    action="mailto:you@yourdomain.com"
    Daniel Short
    DHTMLShock

  3. #3
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    <input type="submit" name="B1" action="mailto:williamsba1@2fssg.usmc.mil">

    what is wrong with this?

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The action goes in your form tag, not in your submit button. Here's a simple form that would do what you want:

    Code:
    <form name="form1" method="post" action="mailto:me@mydomain.com">
      <p>What's your name: 
        <input type="text" name="textfield">
      </p>
      <p>
        <input type="submit" name="Submit" value="Submit">
      </p>
    </form>
    Daniel Short
    DHTMLShock

  5. #5
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ok i got it to work. Thank you for your help, but it comes in an email as an attached .ATT file. Is there anyway I can just get the info they put in the form typed in an email to its easier to view.

    When I view this .ATT file all the information is mushed together and is hard to interpret. Thank you

  6. #6
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change the form tag to:

    Code:
    <form method="post" action="mailto:you@yourdomain.com" enctype="text/plain">
    Daniel Short
    DHTMLShock

  7. #7
    I'm baaaaaaaaaaaaack! Fluffykins's Avatar
    Join Date
    Aug 2000
    Location
    Manchester, UK
    Posts
    1,046
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your mail comes out garbled at your end, you could also try:

    Code:
    <form method="post" action="mailto:you@yourdomain.com" enctype="multipart/form-data">
    One of the two enc types will work better, it depends on your server configuration.

    Ady
    v-technologies - Freelance Goodness.

  8. #8
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ok I got the form to work just like I wanted. Now when the user submits the form it stays on the same page. What would be the code to send the user to a different page as soon as they submit the form?

  9. #9
    I'm baaaaaaaaaaaaack! Fluffykins's Avatar
    Join Date
    Aug 2000
    Location
    Manchester, UK
    Posts
    1,046
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For that you'd need to use some JavaScript.

    This might work:

    Code:
    <input type="submit" name="Submit" value="Submit" onClick="window.location='your_link_here.htm'">
    This might not be exactly right (or even work considering I wrote it from memory) but you get the idea

    You need to add it to your submit button on the form.

    Ady
    v-technologies - Freelance Goodness.

  10. #10
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thank you Fluffykins that worked great, but I have run into one more problem. After you hit submit, IE comes up with a warning saying "You are about to send an email, do you want to continue" "Yes" or "No" Now if you hit yes, everything works perfect and the form info is sent and it goes to the "Successfull sent page", but if you hit cancel it still sends you to the "Successfull sent page" Is there a way I can tell what the user selected and based on that answer wether or not to view the "Successfull sent page"? Thank you

  11. #11
    Confirmed Halfwit
    Join Date
    Oct 1999
    Location
    Vancouver, BC, Canada
    Posts
    983
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like you should use a program that likely resides on your web server to handle this task.

    There is a simple program that uses "Perl CGI" called formmail.pl. Ask your web host if they can make this "form to email" program available to you.. most web hosting companies will provide this script free of charge, and have instructions for using it.

    Basically, your form will need to have several settings that are used to tell the program what to do. You can specify the email recipient, where to go if successfully submitted, where to go if not successfull, colours, etc..

    Cheers,
    Henri Straforelli
    - A simple online WYSIWYG editor for HTML code snippets.
    - Managed Web Hosting - $3.95/month (resellers welcome)
    - Why pay more? $8.95 domains & $9.95 SSL certificates!

  12. #12
    Confirmed Halfwit
    Join Date
    Oct 1999
    Location
    Vancouver, BC, Canada
    Posts
    983
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's an example of the HTML code the CGI script will require.. nothing you haven't already played around with..

    <form method="post" action="http://www.yoursite.com/cgi-bin/formmail.pl">
    <input type="hidden" name="recipient" value="youremail@yoursite.com">
    <input type="hidden" name="subject" value="Email Subject Here">
    <input type="hidden" name="redirect" value="http://www.yoursite.com/success.html">
    <input type="hidden" name="missing_fields_redirect" value="http://www.yoursite.com/notvalid.html">
    <input type="hidden" name="env_report"
    value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT">
    <input type="hidden" name="required" value="realname,email,comments">
    <input name="realname" size="30">
    <input name="email" size="30">
    <textarea cols="40" name="comments" rows="4"></textarea>
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" name="Reset" value="Reset">
    </form>
    - A simple online WYSIWYG editor for HTML code snippets.
    - Managed Web Hosting - $3.95/month (resellers welcome)
    - Why pay more? $8.95 domains & $9.95 SSL certificates!

  13. #13
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ok I noticed you mentioned using the servers cgi script. Well the server is the one that we run right here in our shop. Where can I find a cgi to install on there that will do what you are talking about? I understand the HTML part just fine, thank you...

  14. #14
    I'm baaaaaaaaaaaaack! Fluffykins's Avatar
    Join Date
    Aug 2000
    Location
    Manchester, UK
    Posts
    1,046
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by williamsba
    Thank you Fluffykins that worked great, but I have run into one more problem. After you hit submit, IE comes up with a warning saying "You are about to send an email, do you want to continue" "Yes" or "No" Now if you hit yes, everything works perfect and the form info is sent and it goes to the "Successfull sent page", but if you hit cancel it still sends you to the "Successfull sent page" Is there a way I can tell what the user selected and based on that answer wether or not to view the "Successfull sent page"? Thank you
    I don't think you can . The OK / Cancel box is internal to Internet Explorer, so we can't use JavaScript to affect it.

    The FormMail CGI script is the one we use so that might be what you're after. For information on the script itself you can look here: http://www.worldwidemart.com/scripts/formmail.shtml

    This will give you the basics on CGI: http://www.frognet.net/help/archives..._CGI_conf.htm.

    I'm beginning CGI myself and attempting to use free CGI scripts, if I discover anything world-shaking i'll let you know

    Ady

    v-technologies - Freelance Goodness.


Bookmarks

Posting Permissions

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