SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Thread: a form problem.

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    a form problem.

    Hello.

    This is the code I've on my form:

    Code:
    <form action="thank.htm" method="post" name="formulario">
          <input type=hidden name="mail" value="teste@teste.com">
          <input type=hidden name="email_subject" value="teste">
    
    <table width="582" border="0" align="center" cellpadding="10">
        <tr> 
          <td width="121"> 
            <span class="texto">Name:</span> 
          </td>
          <td width="451"> 
            <input type="text" name="identity" size="30" value="">
          </td>
        </tr>
        <td width="121"> <span class="texto">mail:</span></td>
        <td width="451"> 
          <input type="text" name="mail" size="30" value="">
        </td>
        </tr>
    
    </form>
    Well. It doesn't work. I don't received any email with the information about the fields' form.


    I'm looking for a code that redirects the page after the user submits to the thank.htm page. And I want to received all the information in the mail.

    I've another away, but I don't want like this. Because when u click on submit appear an alert box of IE. And it seems that the email_subject doesn't work. But with this code I receveid the information on my mail.
    Code:
    <form action="mailto:margarida@mgoffline.com" enctype="text/plain"  method="post" name="formulario" onsubmit="window.location='thank.htm'">
    
    <input type=hidden name="email_subject" value="teste" >
    Thank you.
    Last edited by magi; Aug 27, 2002 at 08:37.

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. Firstly, with your second method the alert is unavoidable and to get the subject to work you need to use a QueryString like so:

    Code:
    <form action="mailto:margarida@mgoffline.com?Subject=teste" method="post" name="formulario">
    Secondly, without some kind of server-side scripting occuring (maybe formmail.pl on a server running Perl, the ASPMail component on an IIS/ASP server, etc.) your form will do nothing except pass a set of data from one HTML page to another, which is essentially useless. You can't send mail from a HTML page without using a script unless you use your second method that piggy-backs on to your user's mail program. And if you're doing that then you might as well just use a mailto link.

    G

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm using a formmail.pl on a server running Perl.

  4. #4
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. Then your form action needs to point to that Perl script, eg:

    Code:
    <form action="cgi-bin/formmail.pl" method="post" name="formulario">
    And your redirect page needs to be held in a hidden value. I can't remember exactly what it is -- I don't use formmail any more and haven't done for a good while, but all the documentation is at Matt's Script Archive -- he's the guy who originally wrote formmail.pl ...

    It'll be something like:

    Code:
    <input type="hidden" name="redirect" value="../thank.htm"
    G

  5. #5
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm going to check.
    Thank you.

  6. #6
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)



    I can´t do it only using java script???

  7. #7
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No. Not properly. JavaScript is a client-side language (and for you pedants out there -- yes I know you can use JavaScript in ASP pages, but in simple terms it's largely client-side) and so the only means you have of delivering mail is on the client-side, ie: using the mail s/w on your user's machine. That's why you use an application like formmail.pl ... it uses the SERVER to send mail therefore you DON'T have to rely on your users having the right s/w and not clicking 'No' when presented with alert boxes. It all happens server-side. The 'client' doesn't care.

    Formmail.pl is dead easy to configure -- it just takes a little bit of careful reading of the instructions. In fact, I've just checked and my fuzzy distant memory is correct. That hidden tag for your redirect is right. Why would you want to use anything else? It'd be harder .... !



    Just to check, you haven't just placed formmail.pl in your normal server space with your HTML have you?

    G

  8. #8
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. I'm goingo to try. I don't understand none. And even Java Script is a little confused to me. I'm not a programmer.


  9. #9
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So that you don't waste any time, your formmail.pl script must be in a CGI bin. This is a folder on a web server that has had its permissions set so that scripts and prgrams are allowed execute. If your formmail.pl script is not in a CGI bin, it will not work. Normal web space does not allow the execution of scripts as this would be a huge security hole.

    What I'm trying to make sure is that you haven't just placed formmail.pl in your normal web space because if you have it won't work anyway.



    Here are some CGI FAQs ...

    http://www.htmlhelp.com/faq/cgifaq.html

  10. #10
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you. But I'm feeling a completed stupid.

  11. #11
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well don't give up!

    Learning the hard way is also the best way. Ask you hosting company if they can provide specific help for your account. They're often very good.

    G


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
  •